XSLT - Convert science notation number to normal format

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • daydreaming
    New Member
    • Jan 2008
    • 12

    XSLT - Convert science notation number to normal format

    Hi all,

    I need some help to convert the number in science notation format back the normal format.

    The input xml
    <?xml version='1.0' encoding='utf-8'?>
    <product>
    <price>2.022E 9</price>
    </product>

    The required output xml
    <?xml version='1.0' encoding='utf-8'?>
    <product>
    <price>20220000 00</price>
    </product>

    I have wrote the below code, but it did work as what I want yet.

    <?xml version="1.0" encoding="UTF-8" ?>
    <xsl:styleshe et xmlns:xsl="http ://www.w3.org/1999/XSL/Transform" version="2.0">

    <xsl:template match="product" >
    <product>
    <xsl:apply-templates/>
    </product>
    </xsl:template>
    <xsl:template match="//price">
    <price>
    <xsl:value-of select='format-number(., "############## .0000")' />
    <!-- Need a number with 14 digits before decimal point and 4 digits after the decimal point-->
    <xsl:apply-templates/>
    </price>
    </xsl:template>

    </xsl:stylesheet>

    Thank you for any help in advance.
Working...