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.64Mb size Format: txt, pdf, ePub
ads

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.

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

Other books

Bane by Viola Grace
Resolved by Robert K. Tanenbaum
Finding Dell by Kate Dierkes
Honey by Jenna Jameson
The Session by Greg Curtis
Sliding Into Second by Ella Jade
Love On My Mind by Tracey Livesay
In the Unlikely Event... by Saxon Bennett