EXSLT - date:add-duration

Implementer Page: date.add-duration.html
Function Package: date.add-duration.zip

Function Syntax

string date:add-duration(string, string)

Template Syntax

<xsl:call-template name="date:add-duration">
   <xsl:with-param name="duration1" select="string" />
   <xsl:with-param name="duration2" select="string" />
</xsl:call-template>

The date:add-duration function returns the duration resulting from adding two durations together.

Both arguments are strings in the format defined for xs:duration in [3.2.6 duration] of [XML Schema Part 2: Datatypes]. If either argument is not in this format, the function returns an empty string ('').

The return value is a string in the format defined for xs:duration in [3.2.6 duration] of [XML Schema Part 2: Datatypes].

The durations can usually be added by summing the numbers given for each of the components in the durations. However, if the durations are differently signed, then this sometimes results in durations that are impossible to express in this syntax (e.g. 'P1M' + '-P1D'). In these cases, the function returns an empty string ('').

Implementations

The following XSLT processors support date:add-duration:

Implementations of date:add-duration are available in the following languages:

http://www.exslt.org/date/functions/add-duration/index.html last modified 2002-08-21