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

BOOK: XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition
6.87Mb size Format: txt, pdf, ePub
xs:boolean
The value
false
is considered, quite arbitrarily, to be less than
true
.
xs:dateTime
One
xs:dateTime
value is considered less than another if it represents an earlier instant in time. As with equality testing, the two values are adjusted to a common timezone using the implicit timezone from the evaluation context if the value does not have its own timezone. The effect is, for example, that
2008-01-01 T01:00:00Z
is less than
2007-12-31 T23:00:00-05:00
.
xs:date
In XML Schema,
xs:date
values are described as being partially ordered. This means that for some pairs of dates, one of them is clearly earlier than the other, but for other pairs (in particular, a pair of dates in which one has a timezone and the other does not) it's impossible to decide. Putting such a rule into a query language would have been impossibly complex, so instead the decision is made by interpreting all dates without a timezone as being in the implicit timezone defined by the evaluation context. The rule is that one date is less than another if it starts earlier than the other one starts, even if the two dates overlap: for example,
2008-01-01+10:00
is less than
2008-01-01Z
because the New Year starts earlier in Sydney than it does in London.
xs:time
Values of type
xs:time
present a particular problem for ordering, because the values are cyclic. Converting both values to the UTC timezone would produce some strange results; for example, it would make
18:00:00-05:00
greater than
20:00:00-05:00
, because the equivalent UTC times are
23:00:00Z
and
01:00:00Z
, respectively. So instead, the two times are considered to be on the same date (it doesn't matter what date you choose) and are expanded to
xs:dateTime
values by using that date. They are then compared in the same way as
xs:dateTime
values. This doesn't remove all anomalies, but it does make the results reasonably intuitive whenever the two times are in the same timezone.

Other books

Double Fudge by Judy Blume
My Journey to Heaven: What I Saw and How It Changed My Life by Besteman, Marvin J., Craker, Lorilee
Don't Let Go by Nona Raines
Jack and Susan in 1913 by McDowell, Michael
Sleep Toward Heaven by Ward, Amanda Eyre
Técnicas de la mujer vasca para la doma y monta de maridos by Óscar Terol, Susana Terol, Iñaki Terol, Isamay Briones