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:choose> <xsl:when test="$e=0"><xsl:value-of select="$m"/></xsl:when> <xsl:when test="$e >0> <xsl:call-template name="s"> <xsl:param name="m" select="$m * 10"/> <xsl:param name="e" select="$e - 1""/> </xsl:call-template> </xsl:when> <xsl:when test="$e <0> <xsl:call-template name="s"> <xsl:param name="m" select="$m div 10"/> <xsl:param name="e" select="$e + 1""/> </xsl:call-template> </xsl:when> </xsl:choose> </xsl:template> <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')""/> </xsl:call-template> </xsl;variable> then use format-number on the result, $f if you want a particular format. untested... David _____________________________________________________________________ This message has been checked for all known viruses by Star Internet delivered through the MessageLabs Virus Scanning Service. For further information visit http://www.star.net.uk/stats.asp or alternatively call Star Internet for details on the Virus Scanning Service. XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Working with Scientific Notat, Michael H. Semcheski | Thread | Re: [xsl] Working with Scientific N, Michael H. Semcheski |
Re: [xsl] Select a node by name, Oleg Tkachenko | Date | Re: [xsl] Working with Scientific N, Jeff Kenton |
Month |