Subject: Re: [xsl] xsl:sort by element name From: "Andrew Welch" <awelch@xxxxxxxxxxxxxxx> Date: Thu, 14 Mar 2002 04:59:51 -0000 |
> > Dear List, > I am trying to sort my output nodes based on their element name. > Mike, This will sort all children of <root> by their name() ==xml== <root> <a>x</a> <c>x</c> <b>x <d>x</d> </b> <z>x</z> <g>x</g> </root> ==output== <a /><b /><c /><d /><g /><z /> ==xsl== <xsl:template match="/"> <xsl:apply-templates select="root//*"> <xsl:sort select="name()"/> </xsl:apply-templates> </xsl:template> <xsl:template match="*"> <xsl:copy/> </xsl:template> cheers andrew > > Dear List, > I am trying to sort my output nodes based on their element name. > > Could someone give me a hint on this one? > > Mike F. > > > XML: > <LLL> > <C1012>...C-data...</C1012> > <C1012>...A-data...</C1012> > <C1012>...B-data...</C1012> > </LLL> > > Output should be: > <LLL> > <C1012>...A-data...</C1012> > <CC1012>...B-data...</CC1012> > <CCC1012>...C-data...</CCC1012> > </LLL> > > > XSL: > <xsl:template select="/"> > <xsl:for-each select="/*"> > <xsl:sort select="name()"/> > <xsl:apply-templates select="C1012"/> > </xsl:for-each> > </xsl:template> > > __________________________________________________ > Do You Yahoo!? > Try FREE Yahoo! Mail - the world's greatest free email! > http://mail.yahoo.com/ > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Vertical Resulting Displa, Andrew Welch | Thread | [xsl] How can I simulate a replicat, Rene de Vries |
Re: [xsl] Vertical Resulting Displa, Andrew Welch | Date | RE: [xsl] EXSLT in ASP.NET?, Joshua Allen |
Month |