xsl-list
[Top] [All Lists]

RE: [xsl] xsl:sort with nulls at end

2008-11-03 13:19:34

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
http://www.saxonica.com/


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>