Subject: RE: [xsl] XSLT 2.0 Multi-level grouping From: "Michael Kay" <mike@xxxxxxxxxxxx> Date: Thu, 10 Jan 2008 16:27:24 -0000 |
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: [xsl] 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>
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] XSLT 2.0 Multi-level grou, Andrew Welch | Thread | Re: [xsl] XSLT 2.0 Multi-level gro, Florent Georges |
Re: [xsl] Transforming XML to CSV, Mario Madunic | Date | RE: [xsl] Filtering a node-set, Michael Kay |
Month |