This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: <sort lang="sv"/> in Saxon


Hi Joerg,

> I could not find anything which mandates the processor to even take
> a serious look at the language, not to mention doing anything the
> user might expect like doing the sort according to the local
> collating sequence. Is this about to change in the next release of
> the standard?

The XSLT Rec specifically states:

  lang specifies the language of the sort keys; it has the same range
  of values as xml:lang [XML]; if no lang value is specified, the
  language should be determined from the system environment

So the local collating sequence should be used if no lang attribute is
specified. (Actually, this is a bit peculiar when you consider the a,
b, c sequence - presumably there are quite a lot of languages aside
from English whose alphabetical sequences start with 'a' - should an
XSLT processor use the local language (if it knows how) or should it
always use the English sequence (specified earlier in the Rec)?)

The Rec also warns:

  NOTE: It is possible for two conforming XSLT processors not to sort
  exactly the same. Some XSLT processors may not support some
  languages. Furthermore, there may be variations possible in the
  sorting of any particular language that are not specified by the
  attributes on xsl:sort, for example, whether Hiragana or Katakana is
  sorted first in Japanese. Future versions of XSLT may provide
  additional attributes to provide control over these variations.
  Implementations may also use implementation-specific namespaced
  attributes on xsl:sort for this.

  NOTE: It is recommended that implementers consult [UNICODE TR10] for
  information on internationalized sorting.

The fact is that sorting according to different languages isn't
straight-forward. There are so many possible languages (especially
when you consider alphabetic/traditional orders as well) that it's a
massive burden to expect every processor to support *every* language.
So I doubt that XSLT 2.0 will make any major changes to the
requirements for language support in XSLT processors.

> And, just for curiosity, does anybody know the rationale for
> inventing the xsl:lang attribute rather than using xml:lang?

*Probably* it's to do with the fact that xml:lang is designed to
indicate the language used by the element content/attribute values on
an element. xsl:sort doesn't have any content; if you used xml:lang it
would be to do things like:

  <xsl:sort xml:lang="fr" order="descente" />

(xsl:)lang, on the other hand, is indicating the language of the sort
values, which is a uniquely XSLT concept.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]