Re: Sorting in XSLT

Stephane Bortzmeyer <[email protected]> Sun, 16 Mar 2008 22:37:10 +0100
Newsgroups gmane.text.xml.french.tech
Message-ID <[email protected]>
On Thu, Mar 13, 2008 at 02:06:56PM +0100,
 hufflen jean-michel <[email protected]> wrote 
 a message of 69 lines which said:

> En cherchant sur le "Net", j'ai vu des endroits où l'on propose un
> contournement : récupérer la concaténation de tous les noms et
> prénoms des auteurs et se baser sur cette gigantesque chaîne.

Tiré d'une liste IETF, un bon exemple de pourquoi c'est une mauvaise
idée :

From: Mark Crispin <[email protected]>

Sorting the addr-name opens a HUGE can of worms.

Given the names "Bandou Mitsugoro", "Mark Crispin", "Nishimura Aiko",
"Pedro Castro Gomez", and "Mao Zedong", a stupid sort will collate these
as:
        Bandou Mitsugoro
        Mao Zedong
        Mark R. Crispin
        Nishimura Aiko
        Pedro Castro Gomez
and a falsely-clever sort will collate these as:
        Nishimura Aiko
        Mark R. Crispin
        Pedro Castro Gomez
        Bandou Mitsugoro
        Mao Zedong
Both of these are totally wrong.

The actual correct collation, assuming(!) surname-first collation and
Latin character ordering(!!), is:
        Bandou Mitsugoro
        Pedro Castro Gomez
        Mark R. Crispin
        Mao Zedong
        Nishimura Aiko
due to where the surname is located in various cultures.

And even that is making multiple unwarranted assumptions.  The addr-name
may not even be a name that has a surname e.g., a corporate name.  Latin
character ordering may not be correct either; in Japanese "Bandou" will
collate before "Nishimura", but "Tanaka" will collate before either of
these.

This is why this was punted to be a sort of the addr-mailbox.  Once again,
changing this now would be an incompatible change that may benefit some,
will cost others, and will create instability and unreliability.