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

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

This doesn't mean that each character must be considered in isolation. The collation can still consider characters in groups, as with the traditional rule in Spanish that
ch
collates as if it were a single character following
c
, and
ll
as a single letter after
l
. But where characters are grouped in this way, it is likely to affect the way substrings are matched, as we will see.

The XPath specification isn't completely prescriptive about how substring matching using a collation should work, and there are several possible approaches that an implementation could use. I'll describe the way the Saxon processor does it, which makes heavy use of the collation support in Java: other Java-based processors are therefore quite likely to be similar.

Firstly, let's look at a case where Java treats one character as two collation units. With a primary strength collation for German, the string
Straße
generates a sequence of seven collation units, which are exactly the same as the collation units generated for the string
strasse
. This means that
contains(“Straße”, $t)
returns true when
$t
is any one of
ß
,

,
ße
,
ss
,
as

Other books

The Defiant Hero by Suzanne Brockmann
Pyramid of the Gods by J. R. Rain, Aiden James
The Company You Keep by Tracy Kelleher
Within That Room! by John Russell Fearn
Manta's Gift by Timothy Zahn
Chances Are by Barbara Bretton
The Prodigal Girl by Grace Livingston Hill
Love Confessed by Tracey, Amber