<xsl
aram name="sortorder" select="'descending'"/>
<xsl
aram name="sortfield" select="'com_device'"/>
<xsl:template match="ROOT">
<ROOT>
<xsl:apply-templates/>
</ROOT>
</xsl:template>
<xsl:template match="read">
<read>
<xsl:apply-templates>
<xsl:comment><xsl:sort select="*[name()=$sortfield]" order="{$sortorder}" /></xsl:comment>
<xsl:sort select="com_device" order="ascending"/>
</xsl:apply-templates>
</read>
</xsl:template>
<xsl:template match="read/*">
<xsl:element name="{name()}">
<xsl:value-of select="." />
</xsl:element>
</xsl:template>
</xsl:stylesheet>
Hey Guys:
am using the above xsl to sort xml file below
<ROOT>
<read><oneCol>data</oneCol><twoCol>data</twoCol><read>
<read><oneCol>data</oneCol><twoCol>data</twoCol><read>
<read><oneCol>data</oneCol><twoCol>data</twoCol><read>
<read><oneCol>data</oneCol><twoCol>data</twoCol><read>
<read><oneCol>data</oneCol><twoCol>data</twoCol><read>
<read><oneCol>data</oneCol><twoCol>data</twoCol><read>
......
</ROOT>
Problem iz the output produces the same xml file.. The sorting does not occur ?? Any Suggestions ?? Thanks..