|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Grouping within sub elements
Tempore 08:45:50, die 01/29/2005 AD, hinc in
xsl-list@xxxxxxxxxxxxxxxxxxxxxx scripsit Steve W <lsl@xxxxxxxxxxxxx>:
Hi,If I was to group all the subitems, I'd use something like <xsl:key name="subs" match="BODY/ITEM" use="SUBITEM" />. The trick is to extend the 'key' elment's 'use' attribute with more information, using the 'concat()' function. e.g.: <xsl:stylesheet xmlns:xsl = "http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method = "text"/> <xsl:key name="subs" match="SUBITEM" use="concat(../ID,.)" /> <xsl:template match="ITEM"> Item <xsl:value-of select="ID"/> Subitems <xsl:apply-templates select="SUBITEM[generate-id()=generate-id(key('subs', concat(../ID,.)))]"/> </xsl:template> <xsl:template match="SUBITEM"> <xsl:value-of select="."/> <xsl:if test="position()!=last()">, </xsl:if> </xsl:template> </xsl:stylesheet>
|
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
|

Cart








