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

Storm Warning by Kadi Dillon
The Meridian Gamble by Garcia, Daniel
Mitosis: A Reckoners Story by Sanderson, brandon
Marked by P. C. Cast, Kristin Cast
The Sending by Geoffrey Household
Ciji Ware by Midnight on Julia Street
Stormbound with a Tycoon by Shawna Delacorte