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



Context information – date and time


XPath 2.0

Return value:

The date value in the xs:date format being current for the evaluation context.



No arguments.

Purpose of use:

The fn:current-date() function is called up without passing on an argument. The date value returned by the function is dependent on the valid context at the time of the evaluation of the appropriate XPath expression and the implementation of the function within the evaluating application.

During a XSLT transformation the function usually returns the date value calculated from the system time. The date value may contain the implicit timezone as a timezone indication.

The function is stable and returns during an ongoing transformation a constant value.

Example 1 - date with timezone in the function context:

fn:current-date() returns: 2007-07-10+12:00.

If a date value with timezone indication applies in the context of the function call, this value is returned. Here, a timezone indication in the form +12 hours compared to UTC time is included.

Example 2 - date without timezone in the function context:

fn:current-date() returns: 2007-07-10.

If a date value without timezone is valid in the context of the function call, the mere date value is returned. Here – in contrast to xs:dateTime indications – no Z is attached to the value (see fn:current-dateTime(), example 2).

Function definition:

XPath 1.0:

The function is not available.

XPath 2.0:

fn:current-date() as xs:date


<< 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