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

BOOK: XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition
6.08Mb size Format: txt, pdf, ePub
Data type
Definition of ordering
xs:string
or
xs:anyURI
An
xs:anyURI
value is treated as a string. The ordering of strings is determined by a collation, in the same way as equality comparison. These operators use the default collation established in the XPath evaluation context, as described in Chapter 7. There's a tension between equality comparison and ordering comparisons: for testing equality, you often want a
weak
collation; for example, one that compares
yes
and
YES
as equal. But for ordering, you often want to put the strings in some kind of order, even if it's fairly arbitrary, so you want
yes
either to be less than
YES
, or greater than it (that is, you want a
strong
collation). If you want to use different collations for different operations, you can achieve this by using the
compare()
function described in Chapter 13, but for the
eq
and
lt
family of operators, you have to choose a single collation that may be a compromise.
Numeric
Any two numeric values can be compared (
xs:integer
,
xs:decimal
,
xs:float
, or
xs:double
). If they are of different types, one value is first promoted to the type of the other in the same way as arithmetic operators (see page 571). They are then tested for numeric order (this means, for example, that
10
is greater than
2
).

Other books

The Time Travel Chronicles by Peralta, Samuel, Sawyer, Robert J., Walker, Rysa, Bale, Lucas, Vicino, Anthony, Lindsey, Ernie, Davis, Carol, Bolz, Stefan, Christy, Ann, Banghart, Tracy, Holden, Michael, Smith, Daniel Arthur , Luis, Ernie, Wecks, Erik
Agent M4: Riordan by Joni Hahn
BOMBSHELL by Turner, Xyla
The Eyes of Kid Midas by Neal Shusterman
The Guinea Stamp by Alice Chetwynd Ley
The Last Temptation of Christ by Nikos Kazantzakis
Trouble in Paradise by Robin Lee Hatcher
Cherringham--Final Cut by Neil Richards
Hunting in Hell by Maria Violante