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

RE: xsl:sort with nulls at end

Subject: RE: xsl:sort with nulls at end
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Mon, 3 Nov 2008 18:19:03 -0000
RE:  xsl:sort with nulls at end
> The issue I have is that if the row is missing that tag, the 
> sort puts that record first. Ie. Nulls come first. I need the 
> nulls to come last.
> Is there a way to get around this and force the nulls to be last?

Add further sort keys:

      <xsl:for-each select="*">
          <xsl:sort select="empty(X)"/>
          <xsl:sort select="X" order="ascending" data-type="text"/>
          <xsl:sort select="empty(Y)"/>
          <xsl:sort select="Y" order="descending" data-type="text"/>
          <xsl:sort select="empty(Z)"/>
          <xsl:sort select="Z" order="ascending" data-type="number"/>

Note that boolean false() sorts before true().

Michael Kay

Current Thread


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.
First Name
Last Name
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.