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

Other books

Heart Of The Sun by Victoria Zagar
Breaking Josephine by Stewart, Marie
Violet Eyes by Debbie Viguié
Speedboat by RENATA ADLER
Silence of Stone by Annamarie Beckel
For Eric's Sake by Carolyn Thornton
01 - The Price of Talent by Peter Whittlesey
A Time To Love by Barbara Cameron