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

Behind Hitler's Lines by Thomas H. Taylor
Castle Orchard by E A Dineley
Death Screams by Tamara Rose Blodgett
Just One Kiss by Isabel Sharpe
Awaken by Kristen Day
Over My Head by Wendi Zwaduk
Paparazzi Princess by Cathy Hopkins