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.34Mb 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

Travesty by John Hawkes
1 In For A Penny by Maggie Toussaint
Ultimatum by Antony Trew
Cat's Paw (Veritas Book 1) by Chandler Steele
El Tribunal de las Almas by Donato Carrisi
Samson's Lovely Mortal by Tina Folsom