Re: [xsl] Working with Scientific Notation

Subject: Re: [xsl] Working with Scientific Notation
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 4 Oct 2002 17:37:47 +0100
probably one of the libraries has something for this, but otherwise
something like

<xsl:template name="s">
  <xsl:param name="m"/>
  <xsl:param name="e"/>
   <xsl:when test="$e=0"><xsl:value-of select="$m"/></xsl:when>
   <xsl:when test="$e &gt;0>
    <xsl:call-template name="s">
      <xsl:param name="m" select="$m * 10"/>
     <xsl:param name="e" select="$e - 1""/>
   <xsl:when test="$e &lt;0>
    <xsl:call-template name="s">
      <xsl:param name="m" select="$m div 10"/>
     <xsl:param name="e" select="$e + 1""/>

<xsl:variable name="f">
    <xsl:call-template name="s">
      <xsl:param name="m" select="substring-before(.,'E')"/>
     <xsl:param name="e" select="substring-after(.,'E')""/>

then use format-number on the result, $f if you want a particular format.



This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service. For further
information visit or alternatively call
Star Internet for details on the Virus Scanning Service.

 XSL-List info and archive:

Current Thread