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

Falling For Disaster by Sterling, K.
I'll Be Seeing You by Suzanne Hayes
Fire Baptized by Kenya Wright
The Stranger by Harlan Coben
That Boy by Jillian Dodd
Love me if you dare by Sabel Simmons
The Island of Dr. Libris by Chris Grabenstein
Taking Connor by B.N. Toler