[xsl] xsl:sort with msxml english language, danish characters, weird results

Subject: [xsl] xsl:sort with msxml english language, danish characters, weird results
From: Bryan Rasmussen <bry@xxxxxxxxxx>
Date: Mon, 25 Oct 2004 11:13:51 +0200
-- 
Bryan Rasmussen

Hi, I was doing some tests of sorting by various languages/charsets etc. and I
came across the following irritation; given xml like the following:
<?xml version="1.0" encoding="UTF-8"?>
<words>
<word>aardvark</word>
<word>xdense</word>
<word>elborg</word>
<word>aardvulf</word>
<word>odense</word>
<word>eelburg</word>
<word>zebra</word>
<word>zandinsky</word>
<word>tip</word>
<word>fthling</word>
<word>fadxl</word>
<word>xerces</word>
</words>
and an xslt like the following:

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0">
<xsl:param name="sortby" select="'en'"/>
<xsl:output method="xml" encoding="utf-8"/>
<xsl:template match="/">
<e>
<xsl:for-each select="/words/word">
<xsl:sort data-type="text" select="." lang="{$sortby}" order="descending" 
case-order="upper-first"/>
<xsl:value-of select="." />,
</xsl:for-each>
</e>
</xsl:template>
</xsl:stylesheet>

the output in msxsl the command line tool for msxml is:

<?xml version="1.0" encoding="utf-8"?><e>zebra,
zandinsky,
xerces,
tip,
xdense,
odense,
fadxl,
eelburg,
elborg,
fthling,
aardvulf,
aardvark,
</e>

This by the way is not the sort order for danish characters, it does not allow
sorting if the language sortby parameter is set to da (or at least not in the
proper order), so this being the case I wonder what the reasoning is behind the
sort order I'm seeing when the sortby parameter is en.

Anybody know, have any ideas? 

Current Thread