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

Strawberry Summer by Cynthia Blair
The Wicked Baron by Sarah Mallory
Remembered Love by Diana Hunter
Spirits in the Wires by Charles de Lint
Seducing Chase by Cassandra Carr
Call Me Amy by Marcia Strykowski