Click to See Complete Forum and Search --> : Sorting numbers in XML


acohen
03-26-2004, 01:29 PM
I am having trouble using the order attribute of <xsl: sort > I want to sort a column of numbers in assending order, and it seems to only sort by the first number in the number string, not the whole number. Here's the relevent XSL:
<xsl:sort select="SUITE" data-type="number" order="ascending"/>

The output is at: http://cohencentral.com/projects/ocs_project/xml/xsl/av_resources.xml

Any help is appreciated. Thanks, A

Khalid Ali
03-28-2004, 09:34 PM
I think what you might want to do is once page is loaded then use JavaScript to sort the table

acohen
03-29-2004, 01:01 PM
Why not use the XML sort attribute? Is it not meant for things like this? -A

Khalid Ali
03-29-2004, 02:41 PM
it will(my understanding) parse the string and sort it as string not as numbers(which you intend it to do)

Harris
03-31-2004, 08:19 AM
Presumably you have this inside an

<xsl: for-each select="#">

</xsl: for-each>

If so then do you have a DTD for your file which is defining your element as text? As far as I know your DTD will determine the data-type, not the data-type attribute in the sort element.