IS it possible to change the following exponential notation to integer notation using XSLT 2.0.
2.0151109001E10 to 20151109001
I tried with
number(2.0151109001E10)
but it gives NaN as answer.
EDIT: XSLT:
<xsl:variable name="a" select="ss:Cell[$key]/ss:Data"/>
<xsl:variable name="b" select="string($a)"/>
<xsl:variable name="c" select="number($b)"/>
OUTPUT:
<a>2.0151109001E10</a>
<b>2.0151109001E10</b>
<c>2.0151109001E10</c>
The following works out
<xsl:value-of select="xs:decimal(xs:double(translate($a, ',', '.')))"/>
You can try to put them inside the single quotes ''
like this:
number('7.2345E7')
gives
72340000
The real problem with your input is not the exponential notation, but the use of a comma as the decimal mark. XML only recognizes a period as the decimal mark.
Try something like:
<xsl:value-of select="xs:decimal(xs:double(translate($a, ',', '.')))"/>
or:
<xsl:value-of select="format-number(translate($a, ',', '.'), '0')"/>
您可以使用format-number:
format-number(2.0151109001E10, '#')
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.