XSLT and XPath function reference in alphabetical order
(Excerpt from “XSLT 2.0 & XPath 2.0” by Frank Bongers, chapter 5, translated from German)
Value extraction from time values, date values and duration
A timestamp value xs:dateTime which is generated from the individual components passed on.
A date value of xs:date type. The empty sequence is permitted as argument – in this case, the function returns an empty result sequence.
A daytime indication of xs:time type. The empty sequence is permitted as argument – in this case, the function returns an empty result sequence.
Purpose of use:
The fn:dateTime function constructs a timestamp value of xs:dateTime type from the individual components of xs:date and xs:time type passed on to the function as arguments. Both values passed on have to correspond to the timezones. If the empty sequence is passed on instead of one or both arguments, the function returns an empty result sequence.
The result value has the same timezone like the arguments, provided that the timezone is the same for both arguments or only one of the arguments has a timezone indication.
If both arguments have timezone indications, but these do not match, the error »Both arguments to fn:dateTime have a specified timezone« is reported (err:FORG0008).
Example 1 - construction of a timestamp value:
Results in: xs:dateTime('2007-12-31T12:00:00'). The result value, like the input arguments, has no timezone indication.
Example 2 - construction of a timestamp value with timezone:
Results in: xs:dateTime('2007-12-31T12:00:00-05:00'). The first argument has a timezone indication which, as a consequence, appears in the result.
Example 3 - construction of a timestamp value with timezone:
Results in: xs:dateTime('2007-12-31T12:00:00-05:00'). Here, both arguments have the same timezone indication which also appears in the result.
Example 4 - error because of an incorrect timezone indication:
Results in the error err:FORG0008 because the arguments have different timezone indications. The function cancels the processing without an output.
The function is not available.
fn:dateTime($arg1 as xs:date?, $arg2 as xs:time?) as xs:dateTime?
|<< back||next >>|
Copyright © Galileo Press, Bonn 2008
Printing of the online version is permitted exclusively for private use. Otherwise this chapter from the book "XSLT 2.0 & XPath 2.0" is subject to the same provisions as those applicable for the hardcover edition: The work including all its components is protected by copyright. All rights reserved, including reproduction, translation, microfilming as well as storage and processing in electronic systems.
Galileo Press, Rheinwerkallee 4, 53227 Bonn, Germany