i have input xml as
<content>
<date>
<day>14</day>
<month>06</month>
<year>2012</year>
</date>
</content>
want it to be converted into
<content>
<date>2012-06-14T00:00:00</date>
</content>
xslt used
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="content">
<content>
<xsl:apply-templates select="date"/>
</content>
</xsl:template>
<xsl:template match="date">
<date>
<xsl:variable name="year" select="year"/>
<xsl:variable name="month" select="month"/>
<xsl:variable name="day" select="day"/>
<xsl:value-of select="$year" />-<xsl:value-of select="$month"/>-
<xsl:value-of select="$day"/>
</date>
</xsl:template>
</xsl:stylesheet>
i want date in YYYYMMDDTHH:MM:SS format as example 2012-06-15T02:52:37 how can i get it.Which function in xslt “1.0” pics the strings and take the format pattern as such. Can aynone please help me in getting the above format.
This transformation:
when applied on the provided XML document:
produces the wanted, correct result: