Re: [xsl] Using xsl:sort to sort negative values

Subject: Re: [xsl] Using xsl:sort to sort negative values
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 20 Feb 2007 22:14:09 GMT
   Can anyone tell why the code below will not work?

    <xsl:sort select="data" data-type="number"/>

well, we have to guess, as you haven't shown the relevant part of your
code, but my guess is that you have

<xsl:for-each select="data">
    <xsl:sort select="data" data-type="number"/>

which means that the sort key in each case is the string value of 
the data child of the current data element, converted to a number,
but as there are no such elements all elements get the same sort key
(NaN in xslt1, () in xslt2) and so no sorting happens.


    <xsl:sort select="." data-type="number"/>

as you want the value of the element itself, not of a child.


Current Thread