[xsl] xsl:sort with nulls at end

Subject: [xsl] xsl:sort with nulls at end
From: "Rebecca Sapir" <rsapir@xxxxxxxxxxxxxxxxxxxx>
Date: Mon, 3 Nov 2008 12:55:56 -0500
Saxon parser
Xslt 2

I am sorting XML using xsl:sort. It looks something like this.

<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
   <xsl:template match="REPORT">
         <xsl:for-each select="*">
            <xsl:sort select="X" order="ascending" data-type="text"/>
            <xsl:sort select="Y" order="descending" data-type="text"/>
            <xsl:sort select="Z" order="ascending" data-type="number"/>
            <xsl:copy-of select="."/>
   <xsl:template match="*">

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?


This message contains information from Merlin Securities, LLC, or from one of
its affiliates, that may be confidential and privileged. If you are not an
intended recipient, please refrain from any disclosure, copying, distribution
or use of this information and note that such actions are prohibited. If you
have received this transmission in error, please notify the sender immediately
by telephone or by replying to this transmission.

Merlin Securities, LLC is a registered broker-dealer. Services offered through
Merlin Securities, LLC are not insured by the FDIC or any other Federal
Government Agency, are not deposits of or guaranteed by Merlin Securities, LLC
and may lose value. Nothing in this communication shall constitute a
solicitation or recommendation to buy or sell a particular security.

Current Thread