Reputation: 473
In my incoming XML I get an input string like -
50000000
I want to convert it using an XSLT into the following format -
50:00:00.00
How can I achieve it using XSLT? I do not know of any inbuilt functions/templates that can convert it into this format.
Upvotes: 1
Views: 458
Reputation: 117175
This will work for your example, as well as for any other string that contains exactly 8 digits:
<xsl:value-of select="substring($string, 1, 2)"/>
<xsl:text>:</xsl:text>
<xsl:value-of select="substring($string, 3, 2)"/>
<xsl:text>:</xsl:text>
<xsl:value-of select="substring($string, 5, 2)"/>
<xsl:text>.</xsl:text>
<xsl:value-of select="substring($string, 7, 2)"/>
Upvotes: 1