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

BOOK: XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition
13.46Mb size Format: txt, pdf, ePub
E
must be a capital
E
. Apart from these constraints, the system can choose any string that preserves the original value when converted back to a double.
If you want a more user-friendly representation of the number, XSLT allows you to control the formatting using the
format-number()
function. Outside the XSLT environment, you can trim unwanted digits using the function
round-half-to-even()
, which is described in Chapter 13.
untypedAtomic
Returns the same result as converting to a string, but the result is labeled as
untypedAtomic
.

Converting from duration

Destination Type
Rules
duration
The value is returned unchanged.
string
The duration is output in a normalized form in which the number of months will be less than 12, the number of hours less than 24, the number of minutes and seconds less than 60. Zero-valued components are omitted. A zero-length duration is output as
PT0S
, unless it is an instance of
xs:yearMonthDuration
, in which case it is output as
P0 M
.
untypedAtomic
Returns the same result as converting to a string, but the result is labeled as
untypedAtomic
.

Converting from float

Destination Type
Rules
boolean
The values positive zero, negative zero, and
NaN
are converted to
false
, and any other value is converted to
true
.
decimal
The result is the decimal value, within the range of decimal values that the implementation can handle, whose value is numerically closest to the value of the supplied float; if two values are equally close, the value is rounded toward zero. Overflow is handled in the same way as for double-to-decimal conversion: See page 660.
double
The value space for
float
is a strict subset of that for
double
, so it is possible to convert every float value to a double without loss. The specification achieves this by stating that the conversion returns the
double
that has the same exponent and mantissa as the supplied
float
, with zero, NaN and infinity being treated specially.
float
The value is returned unchanged.
string
The rules are the same as those for double-to-string conversion: see page 660.
untypedAtomic
Returns the same result as converting to a string, but the result is labeled as
untypedAtomic
.

Converting from gDay

Destination Type
Rules
gDay
The value is returned unchanged.
string
The output will be in the form
---DD
, followed by a timezone if the value includes one, formatted as for
xs:date
.
untypedAtomic
Returns the same result as converting to a string, but the result is labeled as
untypedAtomic
.

Converting from gMonth

Destination Type
Rules
gMonth
The value is returned unchanged.
string
The output will be in the form
--MM
, followed by a timezone if the value includes one, formatted as for
xs:date
. (There was an error in the XML Schema Recommendation, corrected in later editions, which gave the format as
--MM--
).
untypedAtomic
Returns the same result as converting to a string, but the result is labeled as
untypedAtomic
.

Converting from gMonthDay

Destination Type
Rules
gMonthDay
The value is returned unchanged.
String
The output will be in the form
--MM-DD
, followed by a timezone if the value includes one, formatted as for
xs:date
.
untypedAtomic
Returns the same result as converting to a string, but the result is labeled as
untypedAtomic
.

Converting from gYear

Destination Type
Rules
gYear
The value is returned unchanged.
string
The output will be in the form
YYYY
, followed by a timezone if the value includes one, formatted as for
xs:date
. Negative years are preceded by
-
.
untypedAtomic
Returns the same result as converting to a string, but the result is labeled as
untypedAtomic
.

Other books

Emerald Ecstasy by Lynette Vinet
The Big Seven by Jim Harrison
His Sexy Bad Habit by Cheris Hodges
The Keeper by Long, Elena
The Marriage Contract by Katee Robert