In the XSLT 1.0 spec, the following is stated:
"The sort must be stable: in the sorted list of nodes, any sub list
that has sort keys that all compare equal must be in document order."
Does this mean that if all sort keys compare equal, a node-set will
appear in ascending document order regardless of the 'order'
attribute? Or does this mean that if the 'order' is 'descending',
nodes with identical sort key values will appear in reverse-document
order? If I've learned anything from this list, it's that I should
always take the spec as literally as possible, which would lead me to
believe that ascending document order is expected for any sort
involving equal sort key values...but this doesn't seem useful at
all. =)
Here is a quick example:
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template match="doc">
<xsl:variable name="ord" select="'descending'"/>
<out>
Descending order....
<xsl:for-each select="t">
<xsl:sort data-type="number" order="{$ord}"/>
<xsl:value-of select="."/><xsl:text>|</xsl:text>
</xsl:for-each>
</out>
</xsl:template>
</xsl:stylesheet>
with input:
<?xml version="1.0"?>
<doc>
<t>1</t>
<t>007</t>
<t>1.0</t>
<t>7</t>
<t>bogus</t>
<t>0.5</t>
<t>1.1</t>
<t>11</t>
</doc>
Using Saxon 6.5.4, I get:
<?xml version="1.0" encoding="utf-8"?><out>
Descending order....
11|007|7|1.1|1|1.0|0.5|bogus|</out>
What I expected was:
<?xml version="1.0" encoding="UTF-8"?><out>
Descending order....
11|7|007|1.1|1.0|1|0.5|bogus|</out>
Can anyone help clarify this?
Thanks again,
-Jack
--~------------------------------------------------------------------
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>
--~--