Sorting Numbers using XSL.

Sorting Numbers using XSL.

Post by Soumitra Banerje » Fri, 13 Apr 2001 02:36:31



Hi,

I am trying to sort some numbers using a xsl (code is given below). But the
result of the sorting is not what is expected.

I need some help to find out why the xsl dosen't work.

Regards,

Soumitra

xsl:

<Root>
  <xsl:for-each order-by="+ Code" select="SearchRecord"
xmlns:xsl="http://www.w3.org/TR/WD-xsl">
    <SearchRecord>
      <xsl:attribute name="SupplierID"><xsl:value-of
select="SupplierID"/></xsl:attribute>
      <xsl:for-each select="BuyerCatalog">
       <xsl:attribute name="Code"><xsl:value-of

       <xsl:attribute name="Message"><xsl:value-of

      </xsl:for-each>

    </SearchRecord>
   </xsl:for-each>
</Root>

 
 
 

1. How do i sort a list of numbers using XSL

Hi,
  I have the following XML fragment.
<group>
   <person>
      <name>abc</name>
      <age>1</age>
    </person>
    ...
</group>

I have three other <person> nodes with ages 2, 10 and 11. Now, i use XSL
to represent this data in a table format. I want the rows of the table
to be sorted based on the age.

<xsl:for-each select="//group/person" order-by="age">

But, the order by doesnt seem to work properly. It shows the order as
follows:
1
10
11
2

It looks as though it has done a sort by taking the values as strings
and not numbers.
        How do i make it sort properly ?

Thanks,
Prabakar S

2. MRTG & Sonicwall

3. XSL Sorting of Large Amounts of Data using the number() method

4. FS: Software and hardware(UK)

5. How to sort using xsl:sort on attribute value?

6. Public apology to Infinite Technologies, etc.

7. XSL/XPATH and sorting abs(number)

8. Just a invitation to visit us.

9. Number() sorting in XSL

10. xsl:sort when mix of numbers and null values

11. Newbie xsl:sort and numbering question

12. xsl:sort problems with large number

13. setting xsl:number to start numbers with 0 ?