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

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

              satisfies $d eq 1.0”>

The
some
and
every
expressions are described in Chapter 10.

It is important to remember that an equality test compares the typed values of the nodes, not their identity. For example,
..=/
might seem to be a natural way of testing whether the parent of the context node is the root of the tree. In fact this test will also return true if the parent node is the outermost element, because in a well-formed (and schema-less) tree the typed value of the outermost element is the same as the typed value of the document node. Not only is the test wrong, it could also be very expensive: the value of the root contains all the text in the document, so you might be constructing two strings each a million characters long and then comparing them. XPath 2.0 provides an operator for comparing nodes by identity: you can write this test as
..
is
/
. The
is
operator is described under
Node Comparisons
on page 593.

The rules for comparing two sequences using
=
apply equally when comparing two sequences using an operator such as
<
: the comparison in this case is true if there is some value in the first sequence that is less than some value in the second sequence, under the rules for the
lt
operator. If all the values in the two sequences have the same data type, then the result actually follows the rules in the following table, where
max()
and
min()
represent the maximum and minimum numeric values of items in the sequence, ignoring any
NaN
values.

Other books

65 Proof by Jack Kilborn
The Shooting by Chris Taylor
Scarlet Women by Jessie Keane
Saber perder by David Trueba
Dead on the Island by Bill Crider
Ricochet by Sandra Brown
Midnight Blues by Viehl, Lynn
To Mend a Dream by Tamera Alexander