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

The Third Eye by Mahtab Narsimhan
Flowers in the Blood by Courter, Gay
Texas Thunder by Kimberly Raye
Fallen Land by Patrick Flanery
Smart Women by Judy Blume
The Complicated Earl by Audrey Harrison
Man of My Dreams by Johanna Lindsey