[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] for-each: Sorting and Grouping
Hiya. I have an XML file containing a list of interface names (from IDL) with each having a user-defined class associated with them, which are basic strings. I have built an XSL file which displays them in a single table, and are sorted by the "sort-by" attribute in a 'for-each' tag. The question is, how can I display this list in different tables, groupped by this class. What I want to do is something like: <xsl:for-each select="Interface" order-by="+ Class"> <!-- If this is the first time we have seen this class, then output a new table which includes a class name. --> <!-- Output the current name --> <tr> <td><xsl:value-of select="Name"/></td> </tr> <!-- If this is the last interface with this class in the list, end this table. --> </xsl:for-each> Is this something that can be done? I was thinking if not, I could add the class as an attribute to the <Interface> tag, instead of as a sub-tag, and then doing some sort of conditional selection. But how do you do this since you don't know which classes there will be? Do I need to do this in JavaScript instead? Any help would be greatly appreciated. Steve XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|