At 2006-03-03 15:53 -0800, Aditya wrote:
My output should look like
usr3
usr2
usr1
I used the following snippet of code but it doesnt seem to work as expected.
Your code worked for me (transcript below).
But note that it is wrong for a larger data-set and the data-type should be:
data-type="number"
in order to work properly for larger data sets.
But for your data-set, your code works just fine.
I hope this helps.
. . . . . . . . . Ken
T:\ftemp>type aditya.xml
<cc>
<mods>
<mod>
<usr>usr1</usr>
.......
</mod>
<mod>
<usr>usr2</usr>
.......
</mod>
<mod>
<usr>usr3</usr>
.......
</mod>
</mods>
</cc>
T:\ftemp>type aditya.xsl
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="text"/>
<xsl:template match="/">
<xsl:apply-templates select="/cc/mods"/>
</xsl:template>
<xsl:template match="/cc/mods">
<xsl:for-each select="mod/usr">
<xsl:sort select="position()" order="descending" data-type="text"/>
<xsl:value-of select="."/>
<xsl:text>
</xsl:text>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
T:\ftemp>xslt aditya.xml aditya.xsl con
usr3
usr2
usr1
T:\ftemp>
--
Upcoming XSLT/XSL-FO hands-on courses: Washington,DC 2006-03-13/17
World-wide on-site corporate, govt. & user group XML/XSL training.
G. Ken Holman mailto:gkholman(_at_)CraneSoftwrights(_dot_)com
Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995)
Male Cancer Awareness Aug'05 http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers: http://www.CraneSoftwrights.com/legal
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--