1. Главная
  2. Функции XPath
  3. date:add-duration()

date:add-duration XPath

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

Синтаксис

EXSLT Function Syntax

string date:add-duration(string, string)

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

Описание и примеры

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:

  • libxslt from Daniel Veillard et al. (version 1.0.19)

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