[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Make Hirachy from flat file
Hi, > So far I have only managed to get items grouped by the > row/data[1] element, > but it is the "nested" gruoping by the row/data[2] element there is > bothering me. Did you want something in the lines of <xsl:key name="maingroup" match="row" use="data[1]"/> <xsl:key name="prodgroup" match="row" use="concat(data[1], ' ',data[2])"/> <xsl:template match="test"> <xsl:copy> <xsl:for-each select="row[generate-id() = generate-id(key('maingroup', data[1]))]"> <xsl:variable name="main" select="data[1]"/> <maingroup name="{$main}"> <xsl:for-each select="../row[generate-id() = generate-id(key('prodgroup', concat($main, ' ',data[2])))]"> <prodgroup name="{data[2]}"> <xsl:for-each select="key('prodgroup', concat($main, ' ',data[2]))"> <rows> <itemno> <xsl:value-of select="data[3]"/> </itemno> <description> <xsl:value-of select="data[4]"/> </description> </rows> </xsl:for-each> </prodgroup> </xsl:for-each> </maingroup> </xsl:for-each> </xsl:copy> </xsl:template> Cheers, Jarno - Smashing Pumpkins: Eye 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
|