[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Using xsl:sort to sort negative values

Subject: Re: Using xsl:sort to sort negative values
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 20 Feb 2007 22:14:09 GMT
Re:  Using xsl:sort to sort negative values
   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.

use 

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

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

David

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.