Reputation: 163
I have a filed value like "+000002030" need to convert it to "20.30" how can i do this using XSLT. This value "+000002030" is the dynamic one any value it can come.Please let me know how we can convert it.
Upvotes: 1
Views: 124
Reputation: 28608
A solution in XSLT-2.0 would be
<xsl:value-of select="format-number(number('+000002030') div 100, '#.00')"/>
Upvotes: 0
Reputation: 117003
In XSLT 1.0, use:
<xsl:value-of select="format-number(translate(value, '+', '') div 100, '#.00')"/>
To make this future-proof, use:
<xsl:value-of select="format-number(number(translate(value, '+', '')) div 100, '#.00')"/>
This will work the same in both XSLT 1.0 and XSLT 2.0.
Upvotes: 1