[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: XSLT 2.0 Multi-level grouping
Looks to me like <xsl:template match="Computers"> <xsl:for-each-group select="*" group-by="name()"> <xsl:element name="{current-grouping-key()}"> <xsl:for-each-group select="current-group()/*" group-by="name()"> <xsl:element name="{current-grouping-key()}"> <xsl:copy-of select="current-group()"/> Michael Kay http://www.saxonica.com/ > -----Original Message----- > From: Robert Zegwaard [mailto:data@xxxxxxxxx] > Sent: 09 January 2008 14:17 > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > Subject: XSLT 2.0 Multi-level grouping > > Hi, > > I'm in need for an multi-level grouping routine using XSLT > 2.0 I can't figure out houw to do this. > Can anyone give me a good hint? > > Robert Zegwaard > > XML (INPUT) > --------------------------------------- > <?xml version="1.0" encoding="UTF-8"?> > <Computers> > <Hardware> > <Hardisks> > <Product> > Seagate 200GB > </Product> > <Price> > 129,- > </Price> > </Hardisks> > </Hardware> > <Hardware> > <Hardisks> > <Product> > Maxtor 160GB > </Product> > <Price> > 109,- > </Price> > </Hardisks> > </Hardware> > ... > <Software> > ... > </Software> > ... > </Computers> > > --------------------------------------- > Desired XML (OUTPUT) > --------------------------------------- > <Computers> > <Hardware> > <Hardisks> > <Product> > Seagate 200GB > </Product> > <Price> > 129,- > </Price> > <Product> > Maxtor 160GB > </Product> > <Price> > 109,- > </Price> > </Hardisks> > <Monitors> > ... > </Monitors> > ... > </Hardware> > <Software> > <Office> > ... > </Office> > ... > </Software> > </Computers>
|
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
|