Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Help required in Grouping by category

From: RJN <rjn@-----.--->
To: 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 ***


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent