I have the following XML document:
<soapenv:Envelope xmlns:soapenv="http://ift.tt/sVJIaE">
<soapenv:Header/>
<soapenv:Body>
<Elaborations>
<Elaboration>
<DateBegin>2014-01-01T02:00:00.000+01:00</DateBegin>
<DateEnd>2014-01-01T02:00:00.000+01:00</DateEnd>
<Result>12594</Result>
</Elaboration>
<Elaboration>
<DateBegin>2014-01-01T02:00:00.000+01:00</DateBegin>
<DateEnd>2014-01-01T02:00:00.000+01:00</DateEnd>
<Result>12593</Result>
</Elaboration>
<Elaboration>
<DateBegin>2014-01-01T02:00:00.000+01:00</DateBegin>
<DateEnd>2014-01-01T02:00:00.000+01:00</DateEnd>
<Result>12595</Result>
</Elaboration>
<Elaboration>
<DateBegin>2014-01-01T02:00:00.000+01:00</DateBegin>
<DateEnd>2014-01-01T02:00:00.000+01:00</DateEnd>
<Result>29598</Result>
</Elaboration>
<Elaboration>
<DateBegin>2014-01-01T02:00:00.000+01:00</DateBegin>
<DateEnd>2014-01-01T02:00:00.000+01:00</DateEnd>
<Result>37583</Result>
</Elaboration>
</Elaborations>
</soapenv:Body>
</soapenv:Envelope>
I want to replace the values of the elements DateBegin and DateEnd with the current date and time, with XSLT. I wrote the following transformation:
<?xml version="1.0"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://ift.tt/tCZ8VR">
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:variable name="dateNow" select="current-dateTime()"/>
<xsl:template match="DateBegin/text()">
<xsl:value-of select="$dateNow"/>
</xsl:template>
<xsl:template match="DateEnd/text()">
<xsl:value-of select="$dateNow"/>
</xsl:template>
</xsl:stylesheet>
But I'm getting a parse error. Where is the problem?
No comments:
Post a Comment