grouping by attribute

Subject: grouping by attribute
From: "Sargeant, Richard (GEIS)" <Richard.Sargeant@xxxxxxxxxxx>
Date: Sun, 15 Aug 1999 17:47:39 +0200
Hi, 

   Is there a better way to achieve the following. My XML file contains item
with a category attribute and I need to group each category separately, for
example

	<item category="aaa">xxxxxxx</item>
	<item category="bb">xxxxxxx</item>
	<item category="zzz">xxxxxxx</item>
	<item category="bb">xxxxxxx</item>
	<item category="yyy">xxxxxxx</item>

   At the moment I simply use <xsl:sort select=@category/> to sort and then
test if the category changes by comparing the current category with the
previous item's category. 

   I know I can use a xsl:for-each and select each category in turn but is
it possible to select all the items of each category without having hardcode
the category into the xsl script ?

regards
   Richard Sargeant


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread