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

BOOK: XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition
13.73Mb size Format: txt, pdf, ePub

has no parallel in XPath.

The argument in favor of disallowing an empty sequence was to maximize the freedom of the optimizer to rearrange predicates, so as to make use of indexes. Although the current rules do not compromise transitivity, they do make other rewrites impossible; for example, the expressions
A ne B
and
not(A eq B)
are no longer equivalent.

The other controversial decision is that
xs:untypedAtomic
values are converted to strings regardless of the type of the other operand. Taking again the example
@code eq 3
, this means you will get a type error if the source document has no schema, because you can't compare a string to a number. This rule was introduced in order to make equality transitive. For example, suppose
@code
is an untyped attribute whose string value is
4.00
. Then
@code eq “4.0”
and
@code eq 4.0e0
would both be
true
(one is a string comparison and the other a numeric comparison), and since
4.0 eq 4.0e0
is true, transitivity would then require that the string comparison
“4.0”
eq
“4.0e0”
is also true. This clearly isn't feasible; as strings, these values are not the same thing.

Other books

Fed Up by Sierra Cartwright
The Anatomist's Wife by Anna Lee Huber
It's a Don's Life by Beard, Mary
Stake & Eggs by Laura Childs
Pushing Limits by Kali Cross
The Looking-Glass Sisters by Gøhril Gabrielsen
Pent Up by Damon Suede
"All You Zombies-" by Robert A. Heinlein