Bug in 'xsl:sort'. ( XT vs SAXON. )

Subject: Bug in 'xsl:sort'. ( XT vs SAXON. )
From: Paul Tchistopolskii <paul@xxxxxxx>
Date: Sat, 05 Aug 2000 03:23:11 -0700
Hello.

I wish nobody will kill me, but I'm sure that there is
a bug either in XT or in SAXON. And I wish somebody
who can read the specs better than me will tell me
who is right.  XT is latest XT,  Saxon is instant SAXON
downloaded today.  ( It says : SAXON 5.4 from Michael Kay of ICL )

Sofar I think XT is correct because of :

<XSLTquote>

data-type specifies the data type of the strings; the following values are allowed:

text specifies that the sort keys should be sorted lexicographically in the culturally
correct manner for the language specified by lang

number specifies that the sort keys should be converted to numbers and then sorted
according to the numeric value; the sort key is converted to a number as if by a call to
the number function; the lang attribute is ignored

a QName with a prefix is expanded into an expanded-name as described in [2.4 Qualified
Names]; the expanded-name identifies the data-type; the behavior in this case is not
specified by this document

The default value is text.

</XSLTquote>

Note the last line.

Here is the .xml file:

<doc>
<a><code>A</code></a>
<b><code>-1</code></b>
<c><code>0</code></c>
</doc>

Here is the stylesheet:

<xsl:stylesheet
xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version="1.0">
<xsl:output method="xml" indent="yes"/>

<xsl:template match="/">
<doc>
 <xsl:for-each select="/doc/*">
      <xsl:sort select="code"/>
      <xsl:copy-of select="."/>
 </xsl:for-each>
</doc>
</xsl:template>
</xsl:stylesheet>

Here is the output:

C:\WORK\__SEBASTIAN> saxon t.xml t.xsl

Cannot find ParserManager.properties - using built-in parser
<?xml version="1.0" encoding="utf-8"?>
<doc>
   <b>
      <code>-1</code>
   </b>
   <c>
      <code>0</code>
   </c>
   <a>
      <code>A</code>
   </a>
</doc>

C:\WORK\__SEBASTIAN> java -classpath /JAVA_LIB;/JAVA_LIB/xp.jar;/JAVA_LIB/xt.jar
com.jclark.xsl.sax.Driver t.xml t.xsl

<?xml version="1.0" encoding="utf-8"?>
<doc>
<c>
<code>0</code>
</c>
<b>
<code>-1</code>
</b>
<a>
<code>A</code>
</a>
</doc>


Rgds.Paul.

PS. Hey ! Sebastian!  What if your stylesheets are not XSLT conformant,
but  are influenced by the bug in the engine which you are using ? ;-)




 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread