tom tom wrote:
I wish to add a duration to a date, something along the lines of:
<xsl:value-of select="current-date() + xdt:yearMonthDuration('P6D')"/>.
I am using saxon 8.x, what is the correct way to do this, what should
my namespace declarations be to make this work and does the way I do
this depend on which version of Saxon / another processor I am using?
You are on the right track. Make sure you spell the yearMonthDuration
correctly (there are no days in a yearMonthDuration constructor) and do
not use the xdt namespace anymore
(http://www.w3.org/2004/10/xpath-datatypes), because it has been
superseded by the namespace of XMLSchema
(http://www.w3.org/2001/XMLSchema). Commonly the 'xs' prefix is used,
like with XML Schema datatypes. The rest is simple: just use normal
arithmetic and you are done:
<xsl:sequence select="current-date() + xs:yearMonthDuration('P2Y1M')"
as="xs:date" />
will add two years and one month to today.
Cheers,
-- Abel Braaksma
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--