|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] <xsl:sort> Q
Hi,
I have a simple sort Q. I am trying to sort numbers for a select box in
ascending order. After running it through the XSLT processor, what I do
get is a sort, however, it is sorting based on the first digit of the
number. By doing so, it considers the number "3" to be greater than the
number "27". How do I avert this sorting? ANd I cannot make ID as an
attribute.
Here is a sample XML"
<Names>
<Name>
<Description>abc</Description>
<ID>30</ID>
</Name>
<Name>
<Description>aaa</Description>
<ID>7</ID>
</Name>
<Name>
<Description>bbb</Description>
<ID>27</ID>
</Name>
<Name>
<Description>bbb</Description>
<ID>2</ID>
</Name>
</Names>
Sample XSL:
...
<xsl:template match="/">
<select name="numberlistbox" size="10">
<xsl:apply-templates select="Names/Name">
<xsl:sort select="ID" />
</xsl:apply-templates>
</select>
...
</xsl:template>
<xsl:template match="Name">
<option>
<xsl:value-of select="ID" />
</option>
</xsl:template>
Result:
ID's are:
2
27
30
7
Desired result:
2
7
27
30
Any help is appreciated.
Thanks,
Maulik
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








