![]() |
![]() | ![]() | ![]() | Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries [Thread Prev] >Thread Next - Re: How to sort different nodes by attribute How to sort different nodes by attributeTo: NULL Date: 3/4/2008 11:36:00 AM
I store my database settings in xml as follows:
<?xml version="1.0" encoding="utf-8" ?>
<Columns>
<F1 Seq="0" />
<F2 Seq="1" />
<F3 Seq="3" />
<F4 Seq="9" />
<F5 Seq="2" />
<F6 Seq="4" />
<F7 Seq="8" />
<F8 Seq="5" />
<F9 Seq="7" />
<F10 Seq="6" />
</Columns>
I'd like to have the user sort the column order, so the resulting xml will
look like:
<?xml version="1.0" encoding="utf-8" ?>
<Columns>
<F1 Seq="0" />
<F2 Seq="1" />
<F5 Seq="2" />
<F3 Seq="3" />
<F6 Seq="4" />
<F8 Seq="5" />
<F10 Seq="6" />
<F9 Seq="7" />
<F7 Seq="8" />
<F4 Seq="9" />
</Columns>
I use the following xslt, however it didn't give the result I expect:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/Columns/*">
<xsl:copy>
<xsl:apply-templates>
<xsl:sort select="@Seq" order="descending" data-type="number"/>
</xsl:apply-templates>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
I'm new to xslt, I'd appreciate if anyone could show me how to create the
xslt to address this problem.
Thanks,
P_Prdn
| ![]() | ![]() | ![]() |
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | |||||
|
