File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes XML and Related Technologies and the fly likes xsl sorting problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "xsl sorting problem" Watch "xsl sorting problem" New topic
Author

xsl sorting problem

Sarran Vidyakumar
Greenhorn

Joined: Mar 26, 2003
Posts: 28
<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..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: xsl sorting problem