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
3.21Mb 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

Polly's War by Freda Lightfoot
Creeping Terror by Justin Richards
Initiation by H. N. Sieverding
Witch Lights by Michael M. Hughes
Sweet Seduction by Nikki Winter
Tiger Town by Eric Walters
Forbidden by Armstrong, Kelley