XSLT and XPath function reference in alphabetical order

(Excerpt from “XSLT 2.0 & XPath 2.0” by Frank Bongers, chapter 5, translated from German)

A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z



Value extraction from time values, date values and duration


XPath 2.0

Return value:

An integer of xs:integer type corresponding to the value of the day component within the date value passed on.




Optional. A date value of xs:date type which may include a timezone indication. If the empty sequence is passed on as argument, the function returns the empty sequence.

Purpose of use:

The function returns an integer xs:integer which corresponds to the value of the day component of the date value passed on of xs:date type. The value is first normalised, which means the timezone factor is integrated (see examples). Because of the daytime indication of T00:00:00 being implicit in a date value, this may cause a date jump in case the correction factor has to be subtracted. In this case, a value other than the possibly expected is outputted (see example 2). In principle, the function only returns values between 1 and 31 inclusive – in other cases, the input value would be invalid.

Example 1 - day from date with negative timzone value:




Returns the value 25. In this example, the negative timezone value causes no jump of the date.

Example 2 - day from date with positive timezone value:




Returns the value 31 and not 1, as might be expected. The positive timezone is subtracted during the normalisation and causes a date jump to the previous day – in this example to the 31st of the previous month.

Function definition:

XPath 1.0:

The function is not available.

XPath 2.0:

fn:day-from-date($arg as xs:date?) 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