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
An integer of xs:integer type which corresponds to the year of the timestamp value passed on after its normalisation.
Optional. A timestamp value of xs:dateTime type which corresponds to a date value with daytime indication from which the year component shall be extracted.
Purpose of use:
The function returns an integer of xs:integer type which corresponds to the year component of the normalised timestamp value passed on. An implicit timezone factor, if available, is included. If the input value is the empty sequence, the function returns an empty result sequence.
Example 1 - extraction of the year from a timestamp value:
results in the value: 2007.
In this example, an implicit timezone indication of -5:00 was assumed, accordingly -PT5H0M. Because of the normalisation, there is no difference for the year outputted. However, this may be different in borderline cases – see the following example.
Example 2 - date change by normalisation:
results in the value: 2008.
In this example, an implicit timezone indication of -5:00 was assumed, accordingly -PT5H0M. During the normalisation of the timestamp value, the original timezone factor is subtracted and the new one is added. Here, T19:30:00 – (-05:00) + (-05:00) results in a jump to T00:30:00 of the following day, which causes a date change and as a consequence, the output of the year 2008.
The function is not available.
fn:year-from-dateTime($arg as xs:dateTime?) as xs:integer?
|<< 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