Re: [xsl] Simple Xsl Problem

Subject: Re: [xsl] Simple Xsl Problem
From: "J.Pietschmann" <j3322ptm@xxxxxxxx>
Date: Mon, 10 Nov 2003 01:38:27 +0100
Nischal wrote:
I trying to build a generic xsl transform which would
pick up all the unique Orders(Order1's, Order2's and
Order3's and so on...) and build a table like below.

It seems Muenchean grouping gives the most elegant and generalizable solution. Try <xsl:key name="orders-by-name" match="orders/*" use="name()"/> <xsl:template match="Orders"> <xsl:for-each select="*[generate-id()=generate-id(key( 'orders-by-name',name())[1])]"> <p><xsl:value-of select="name()"/></p> <table> <tr> <xsl:for-each select="*"> <td><xsl:value-of select="name()"/></td> </xsl:for-each> </tr> <xsl:for-each select="key('orders-by-name',name())"> <tr> <xsl:for-each select="*"> <td><xsl:value-of select="."/></td> </xsl:for-each> </tr> </xsl:for-each> </table> </xsl:template> Untested, beware of small problems, it's in the midst of the night.

J.Pietschmann


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



Current Thread