[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re:Reformatting a flat XML doc into an XML hierarchy b
Hi, Vidhya, Following may help for your problem. Please refer to recent Jeni's reply for multi-level group http://sources.redhat.com/ml/xsl-list/2001-04/msg00120.html <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output indent="yes"/> <xsl:key name="foo" match="row" use="year"/> <xsl:key name="bar" match="row" use="concat(year,' ',acct)"/> <xsl:template match="/"> <data> <xsl:for-each select="data/row[generate-id(.) =generate-id(key('foo',year)[1])]"> <xsl:variable name="year" select="year"/> <ActivityDate year="{$year}"> <xsl:for-each select="key('foo',year)[generate-id(.) =generate-id(key('bar',concat(year,' ',acct))[1])]"> <xsl:variable name="acct" select="acct"/> <Acct id="{$acct}"> <xsl:for-each select="key('bar',concat(year,' ',acct))"> <Name> <xsl:value-of select="acctname"/> </Name> </xsl:for-each> </Acct> </xsl:for-each> </ActivityDate> </xsl:for-each> </data> </xsl:template> </xsl:stylesheet> hope it will help sun-fu yang sfynag@xxxxxxxxxxxxx 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
|