Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: XSL output of complete element

From: sbparsons@-----------.---------.---
To: 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
> 
> 


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent