Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Re: Sort xml by the attribute [Thread Next] Re: Sort xml by the attributeTo: NULL Date: 4/13/2007 2:44:00 AM
In this template:
<!-- Folder node -->
<xsl:template match="folder">
<xsl:copy>
<xsl:apply-templates select="leaf">
<!-- Sort the node by the sender then date -->
<xsl:sort select="@sender" data-type="text"/>
<xsl:sort select="@date" data-type="text"/>
</xsl:apply-templates>
</xsl:copy>
</xsl:template>
...you should also take care of the nested folder elements.
E.g.:
<!-- Folder node -->
<xsl:template match="folder">
<xsl:copy>
<xsl:apply-templates select="leaf | folder">
<!-- Sort the node by the sender then date -->
<xsl:sort select="@sender" data-type="text"/>
<xsl:sort select="@date" data-type="text"/>
</xsl:apply-templates>
</xsl:copy>
</xsl:template>
Yes, XSLT can be recursive.
ML
---
http://milambda.blogspot.com/
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
