[xsl] Re: Re: sort and collating sequence

Subject: [xsl] Re: Re: sort and collating sequence
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Tue, 26 Feb 2002 00:21:38 -0800 (PST)
> xsl:sort gives "dictionary order", so what you see is according to 
> specification.  As programmers we are used to sorting by ASCII code,
> but this is intentionally different.
>
>
>On Mon, 25 Feb 2002, Paul Bell wrote:
>
..Hi All,
..
..I recently scoured the xsl-list digest in search of information about
..how the several xsl:sort implementations construe the notion of a
..'collating sequence'.  My own observation is that xsl:sort (msxml3 at
..least) does a kind of 'semantic sorting'. For example, the values:
..
..aaa
..bbb
..ccc
..AAA
..BBB
..CCC
..
..sorted order="ascending" data-type="text" are presented as:
..
..aaa
..AAA
..bbb
..BBB
..ccc
..CCC
..
..I work at a company that knows a little about sorting and I find this
..sequence odd. Shouldn't it be:
..
..AAA
..BBB
..CCC
..aaa
..bbb
..ccc
..
..This behavior seems so wrong to me, yet it is so unremarked in the
..digest that I feel I must be missing something huge. Can anyone shed
..any light on the correctness of this behavior? Is it unique to
msxml3?
..Can one use xsl:sort to produce what seems to me the proper sequence?
..

There's no explicit rule what should be the result of xsl:sort. The
XSLT 1.0 spec (http://www.w3.org/TR/xslt#sorting) says:

"NOTE: It is possible for two conforming XSLT processors not to sort
exactly the same."

In fact, this is one of the reasons why it is not generally possible to
create "100% portable" stylesheets.

Therefore, the fact that an XSLT processor A sorts in different order
than XSLT processor B, doesn't mean that either of these is wrong.

Cheers,
Dimitre Novatchev.


__________________________________________________
Do You Yahoo!?
Yahoo! Sports - Coverage of the 2002 Olympic Games
http://sports.yahoo.com

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


Current Thread