EXSLT - Dates and Times

Implementer Page: date.html
Module Package: date.zip

EXSLT - Dates and Times covers date and time-related extension elements and functions.

Many of the functions in this module use strings in the formats specified by the date and time-related data types defined in [XML Schema Part 2: Datatypes].

XSLT processors may support any number of the extension elements and functions given in this module.

Using EXSLT will only make your stylesheet portable amongst the implementations that support EXSLT. Note that there is no requirement for XSLT processors that are compliant to XSLT to support the extensions described within EXSLT.

Namespace

The namespace for EXSLT - Dates and Times is:

http://exslt.org/dates-and-times

Throughout this document, the prefix date is used to refer to this namespace. Any other prefix can be used within a particular stylesheet (though a prefix must be specified to enable the extension functions to be recognised as extensions).

To use these extensions, you need to declare this namespace as an extension namespace in your stylesheet. If your processor supports this module, then that's all you need to do, but if it doesn't, then you need to use a specific third-party implementation or the module stylesheet. Typically, your stylesheet will look like:

<xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:date="http://exslt.org/dates-and-times"
                extension-element-prefixes="date">

<xsl:import href="date.xsl" />

...
              
</xsl:stylesheet>

Elements

Other Elements

The following extension elements are not considered stable and are not part of the core of EXSLT - Dates and Times. Processors that claim support of EXSLT - Dates and Times might not support these elements.

ElementSyntaxDownload
date:date-format
<date:date-format
   name = qname
   calendar = "gregorian" | qname-but-not-ncname
   lang = language
   first-day-of-week = "sunday" | "monday" | "tuesday" | "wednesday" | "thursday" | "friday" | "saturday" | string />
date.date-format.zip

Functions

Core Functions

The following extension functions are considered stable and are core to EXSLT - Dates and Times. Processors that claim support of EXSLT - Dates and Times support these functions.

FunctionSyntaxDownload
date:date-timestring date:date-time()date.date-time.zip
date:datestring date:date(string?)date.date.zip
date:timestring date:time(string?)date.time.zip
date:yearnumber date:year(string?)date.year.zip
date:leap-yearboolean date:leap-year(string?)date.leap-year.zip
date:month-in-yearnumber date:month-in-year(string?)date.month-in-year.zip
date:month-namestring date:month-name(string?)date.month-name.zip
date:month-abbreviationstring date:month-abbreviation(string?)date.month-abbreviation.zip
date:week-in-yearnumber date:week-in-year(string?)date.week-in-year.zip
date:day-in-yearnumber date:day-in-year(string?)date.day-in-year.zip
date:day-in-monthnumber date:day-in-month(string?)date.day-in-month.zip
date:day-of-week-in-monthnumber date:day-of-week-in-month(string?)date.day-of-week-in-month.zip
date:day-in-weeknumber date:day-in-week(string?)date.day-in-week.zip
date:day-namestring date:day-name(string?)date.day-name.zip
date:day-abbreviationstring date:day-abbreviation(string?)date.day-abbreviation.zip
date:hour-in-daynumber date:hour-in-day(string?)date.hour-in-day.zip
date:minute-in-hournumber date:minute-in-hour(string?)date.minute-in-hour.zip
date:second-in-minutenumber date:second-in-minute(string?)date.second-in-minute.zip

Other Functions

The following extension functions are not considered stable and are not part of the core of EXSLT - Dates and Times. Processors that claim support of EXSLT - Dates and Times might not support these functions.

FunctionSyntaxDownload
date:format-datestring date:format-date(string, string)date.format-date.zip
date:parse-datestring date:parse-date(string, string)date.parse-date.zip
date:week-in-monthnumber date:week-in-month(string?)date.week-in-month.zip
date:differencestring date:difference(string, string)date.difference.zip
date:addstring date:add(string, string)date.add.zip
date:add-durationstring date:add-duration(string, string)date.add-duration.zip
date:sumstring date:sum(node-set)date.sum.zip
date:secondsnumber date:seconds(string?)date.seconds.zip
date:durationstring date:duration(number?)date.duration.zip

http://www.exslt.org/date/index.html last modified 2001-05-12