Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Re: XSL output of complete element [Thread Next] Re: XSL output of complete elementTo: NULL Date: 7/2/2008 10:22:00 AM Thanks for that. The time differences are to blame for the delay in responding to you! Regards. "msbalaji" wrote: > On Jul 2, 2:38 am, sbparsons <sbpars...@discussions.microsoft.com> > wrote: > > Please can someone give me a sample xsl to output a complete element in a > > for-each loop? > > For example I'd like to sort the output on <level> by the <sort> value, but > > as you can see, the elements underneath the <level> node may vary : > > <root> > > <level> > > <sort>2</sort> > > <x></x> > > <y></y> > > </level> > > <level> > > <sort>1</sort> > > <x></x> > > <a></a> > > </level> > > <level> > > <sort>3</sort> > > <c></c> > > <d></d> > > <e></e> > > </level> > > </root> > > > > Expected output: > > <root> > > <level> > > <sort>1</sort> > > <x></x> > > <a></a> > > </level> > > <level> > > <sort>2</sort> > > <x></x> > > <y></y> > > </level> > > <level> > > <sort>3</sort> > > <c></c> > > <d></d> > > <e></e> > > </level> > > </root> > > > > Thanks - I'm sure it's a doddle for someone here. > > Hi, > > <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/ > Transform"> > <xsl:template match="root"> > <xsl:copy> > <xsl:for-each select="level"> > <xsl:sort select="sort" data-type="number"/> > <xsl:copy-of select="."/> > </xsl:for-each> > </xsl:copy> > </xsl:template> > </xsl:stylesheet> > > Regards, > Balaji. M > sql-ebooks.blogspot.com > > | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
