xml - XSLT : Converting int to float / double value -
i have xml file. how can convert int value double or float or vice versa using xslt? example, assume following source document :
<a> <b> 22 </b> <a>
result document
<a> <b> 22.0 </b> <a>
you can use format-number() function.
<?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform"> <xsl:template match="@* | node()"> <xsl:copy> <xsl:apply-templates select="@* | node()"/> </xsl:copy> </xsl:template> <xsl:template match="b"> <b> <xsl:value-of select="format-number(., '#.0')" /> </b> </xsl:template> </xsl:stylesheet>
Comments
Post a Comment