bl*******@gmx.net wrote:
I have a source file with
<StartEvent starttime="2006-04-19T20:15:00Z"/>
I want to transform it with XSLT into
<Starttime>2006-04-21T20:15:00Z</Starttime>
The clue:
Onto the date, there should be added 2 days.
Is that possible?
XSLT/XPath 2.0 can do that, here is an example stylesheet
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xdt="http://www.w3.org/2005/xpath-datatypes"
exclude-result-prefixes="xs xdt"
version="2.0">
<xsl:output indent="yes" />
<xsl:template match="StartEvent">
<Starttime><xsl:value-of select="xs:dateTime(@starttime) +
xdt:dayTimeDuration('P2D')" /></Starttime>
</xsl:template>
</xsl:stylesheet>
Result with Saxon 8 from <http://www.saxonica.com/> is e.g.
<Starttime>2006-04-21T20:15:00Z</Starttime>
--
Martin Honnen
http://JavaScript.FAQTs.com/