David Carlisle wrote:
sort order is processor specific, but there is a processor independent
way to achieve
the behaviour we would like is for the
various different unaccented and accented alphas to be treated as
equivalent for sorting purposes.
A general solution to locale-specific sorting in XSL 1.0 is to provide a
custom collator implementation. This is often needed because the correct
collation sequence for a given body of information in a given language
may be determined by any number of variables, including editorial
preference, the type of document it is, the information being sorted
(part numbers vs index entries vs glossary items).
Saxon 6.5 provides a simple extension mechanism by which you create a
simple Java class named com.icl.saxon.sort.Compare_xx where "xx" is the
language code for the language you want to sort on. You then use the
normal Java rule-based-collator mechanism to define the collation rules
for your language. Finally, you use the lang= attribute of xsl:sort to
specify your language code, which Saxon will then attempt to match to a
collator class, e.g., if your language code is "gr-AN" (a made-up code
for ancient Greek), then you would need a collator class named
Compare_gr-AN and would specify xsl:sort as:
<xsl:sort lang="gr-AN" ...
Saxon 7 uses a somewhat different approach for integrating custom
collators but the basic concepts are the same. Also XSL 2 has more
built-in features for specifying custom collators but cannot eliminate
the requirement that specific collation rules must be implemented and
integrated with your XSLT engine.
As far as I know Saxon is the only XSLT 1 engine that enables the
integration of custom collators. If there are others I do not know about
them. I don't know about XSLT 2 engines.
Cheers,
Eliot
--
W. Eliot Kimber
Professional Services
Innodata Isogen
9030 Research Blvd, #410
Austin, TX 78758
(512) 372-8122
eliot@xxxxxxxxxxxxxxxxxxx
www.innodata-isogen.com