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

BOOK: XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition
12.63Mb size Format: txt, pdf, ePub
  • You can't assume that if
    $X=$Y and $Y=$Z
    , then
    $X=$Z
    . Again, sequences are the culprit. Two sequences are considered equal if there is a value that both have in common, so
    (2,3)=(3,4)
    is true, and
    (3,4)=(4,5)
    is true, but
    (2,3)=(4,5)
    is false.

In this strange Orwellian world where some values seem to be more equal than others, the one consolation is that
$X=$Y
always means the same as
$Y=$X
.

Although
!=
is often best avoided, it can be useful to test whether all items in a sequence have the same value. For example, writing

tests whether there is any node in the sequence
$documents//version
whose numeric value is not 1.0. However, it is probably less confusing to write the above test as:

Other books

A este lado del paraíso by Francis Scott Fitzgerald
The Gigolo by King, Isabella
The Arrangement by Bethany-Kris
The Great Fog by H. F. Heard
Among the Nameless Stars by Diana Peterfreund
Buried Secrets by Margaret Daley