This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Working with Scientific Notation
- From: Jeni Tennison <jeni at jenitennison dot com>
- To: "Michael H. Semcheski" <mhs-list at aylix dot com>
- Cc: xsl-list <xsl-list at lists dot mulberrytech dot com>
- Date: Fri, 4 Oct 2002 18:07:27 +0100
- Subject: Re: [xsl] Working with Scientific Notation
- Organization: Jeni Tennison Consulting Ltd
- References: <3D9DBDF3.5090906@aylix.com>
- Reply-to: xsl-list at lists dot mulberrytech dot com
Hi Michael,
> I was wondering if anyone knows of a good way to convert very small
> numbers represented in scientific notation to a standard decimal.
>
> The situation is this: I converted a spreadsheet from MS Excel 2002
> into an MS XML Spreadsheet (more on that later). I have an xsl file
> that can convert the spreadsheet into a
> more-attractive-than-the-MS-html-output html file. (And in total,
> there are too many files to do things worksheets that need to be
> converted to do this by hand). Many of the values that are formatted
> as percents in excel show up in scientifc notation (eg
> -9.1053999999999996E-2) in the xml output. When I try to format them
> with format-number(), they show up as NaN. (This is the MSXML
> DOMDocument 3.0, by the way). Now I think I've read that JDK 1.2
> processors don't bite on this, but the MSXML does. This is a real
> pain, because the decimals really need to be rounded by
> format-number() for the output to look decent.
The pure-XSLT options you've been given would probably be best, but if
it be feasible for you to upgrade to MSXML4, you could use the
extension function:
ms:number()
to convert the string into an XPath number.
Cheers,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list