Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries [Thread Prev] >Thread Next - Re: Help required in Grouping by category Help required in Grouping by categoryTo: NULL Date: 5/10/2007 9:47:00 PM
Hi
I'm new to xsl and need help in grouping elements in xsl.
I've an xml as below
<rs:data ItemCount="4">
<z:row Title="Title1" Description="Desc1" Category="AAA" />
<z:row Title="Title2" Description="Desc2" Category="AAA" />
<z:row Title="Title3" Description="Desc3" Category="BBB" />
<z:row Title="Title4" Description="Desc4" Category="CCC" />
</rs:data>
There are multiple elements in each category. I would want to render
this xml grouped by Category through an xsl as:
AAA
Title1, Desc1
Title2, Desc2
BBB
Title3, Desc3
CCC
Title4, Desc4
I thought I'll apply the for-each loop and then either create an array
which contains the distinct category or create a delimited string with
the distinct categories. Once I've the distinct categories, I can apply
the for-each loop again and apply the xpath to get the corresponding
categories.It seems xsl doesn't support array, nor does it allow me to
change the value of variable. It doesn't allow me declare the variable
and then assign the value inside the for-each loop.
Could someone help me with this xsl transformation? Is there a way that
I can declare a global variable under xsl:stylesheet and change value of
when looping through the nodes?
Your help is greatly appreciated.
Regards
rn
*** Sent via Developersdex http://www.developersdex.com ***
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
