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
12.32Mb size Format: txt, pdf, ePub
ads

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

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

Other books

Another Day as Emily by Eileen Spinelli
Shattered Shell by Brendan DuBois
Papel mojado by Mongolia,
Primal Cravings by Susan Sizemore
Wrecked by West, Priscilla
1979 - A Can of Worms by James Hadley Chase
My Surrender by Connie Brockway