My input XML:
<chatTranscript startAt="2017-06-28T20:00:17Z">
<message>hai</message>
</chatTranscript>
in the input timestamp it contains Z. But Z should removed in the output XML like below:
<chat>
<time>2017-06-28T20:00:17</time>
</chat>
XPath 2.0 has a function for that:
XSLT 2.0
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/chatTranscript">
<chat>
<time>
<xsl:value-of select="adjust-dateTime-to-timezone(@startAt, ())"/>
</time>
</chat>
</xsl:template>
</xsl:stylesheet>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.