XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition (322 page)

BOOK: XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition
2.57Mb size Format: txt, pdf, ePub

http://saxon.sf.net/collation?lang=de;strength=secondary;

requests a collation suitable for German (
lang=de
) in which secondary differences between characters (in practice this means case) are considered significant, but tertiary differences (in practice, accents) are not. So
“A”=“a”
is false but
“a”=“ä”
is true. However, this way of constructing a collation URI is peculiar to Saxon, and other products will have their own conventions.

If you want to write XPath expressions that are portable between products, it's a good idea to assign your chosen collation URI to a variable in the host language, and to reference it using the variable within the XPath expression itself.

The default collation is the one that's used in simple comparisons, such as
@a
=
“potato”
. It's worth thinking carefully about your choice of default collation. Generally speaking, if you're searching for text then you want to cast the net wide, which means you want a weak collation (one that treats
A
and
ä
as equal). But if you're sorting, you want to make fine distinctions, which means you need a strong collation. Sorting algorithms look first for primary differences between words (
a
versus
b
), then for secondary differences (
a
versus
A

Other books

The Days of Redemption by Shelley Shepard Gray
Vaseline Buddha by Jung Young Moon
Blind Reality by Heidi McLaughlin
To Collar and Keep by Stella Price, Audra Price
04.Die.My.Love.2007 by Casey, Kathryn
Dawnbreaker by Jocelynn Drake
Ember by James K. Decker
Full-Blood Half-Breed by Cleve Lamison
The Embers of Heaven by Alma Alexander