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

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -