I have the input
<Date value="20091223"/>
and I want the output to be
<Date>23122009</Date>
I was trying to use substring function to reformat the date
<xsl:value-of select="substring($Date,1,4)"/>
But how to concatenate the extracted year and months and day together.
Assuming whitespace isn't preserved, just put them one after the other:
<xsl:value-of select="substring($Date,7,2)"/>
<xsl:value-of select="substring($Date,5,2)"/>
<xsl:value-of select="substring($Date,1,4)"/>
If whitespace is preserved, just put them all on the line, without spaces between them.
The Xpath concatenation function will also work, but I find it less readable:
<xsl:value-of select="concat(substring($Date,7,2), substring($Date,5,2), substring($Date,1,4))"/>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With