<xsl:sort> Q

Subject: <xsl:sort> Q
From: mxmodi@xxxxxxxxxxxxxxx
Date: Tue, 21 Nov 2000 17:52:14 -0600
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


Current Thread
  • <xsl:sort> Q
    • mxmodi - Tue, 21 Nov 2000 17:52:14 -0600 <=
      • Mike Brown - Tue, 21 Nov 2000 17:56:42 -0700 (MST)
      • <Possible follow-ups>
      • Kay Michael - Wed, 22 Nov 2000 11:35:17 -0000