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
3.88Mb 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 Maggot People by Henning Koch
Pretend You Love Me by Julie Anne Peters
Marriage at a Distance by Sara Craven
Billionaire on the Loose by Jessica Clare
Coercing Virtue by Robert H. Bork
The Ten Commandments by Anthea Fraser
Burned Away by Kristen Simmons