Solved

scientific notation

Posted on 2008-10-03
1
637 Views
Last Modified: 2013-11-18
Hi experts,

The following code is trying to remove the scientific notation. However, it fails to do so for negative values, such as -2.5e-3

How do I revised the code? Thanks
----------------------------------------------
<xsl:function name="fn:remove-scientific-notation">
        <xsl:param name="atr" />
        <xsl:choose>
            <xsl:when test="matches($atr, '^[\d\.,]*[Ee][+\-]*\d*$')">
                <xsl:value-of
                    select="format-number(number($atr), '#0.#############')">
                </xsl:value-of>
            </xsl:when>
            <xsl:otherwise>
                <xsl:value-of select="$atr"></xsl:value-of>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:function>
0
Comment
Question by:meow00
1 Comment
 
LVL 60

Accepted Solution

by:
Geert Bormans earned 350 total points
ID: 22637589
         <xsl:when test="matches($atr, '^\-?[\d\.,]*[Ee][+\-]*\d*$')">
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question