xsl-list
[Top] [All Lists]

Re: Is this a sorting bug in xalan 6.4.0?

2003-02-07 00:47:45
On Thursday, February 6, 2003, at 09:51  PM, Roger Glover wrote:

I am sure there are lots of people here who can trump my experience handily, but is my expectation that spaces will be significant in string sorting, at
least by default, really *that* parochial?


This was my thinking as well. There's more though. It appears that in addition to the space character, xalan also ignores "-" as well. I found a bug report on the xalan bugzilla database:

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=13830

Xalan uses the java.text.Collator object (the compare method) to compare strings, probably because it does locale-sensitive string comparisons. So if there is anyone to blame in this case, it is Sun. The xalan developers don't appear to consider it a bug.

Interestingly, the String object's compareTo method sorts strings with spaces and minus signs as I would expect because it does a lexicographic comparison. Presumably, String.compareTo is not necessarily locale-specific, otherwise, why provide a separate object like Collator just for comparing strings. I'm curious at how Saxon does string comparisons for the purpose of implementing xsl:sort.

StanD.


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