[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Math: Removing X number of zeroes from number Y.

Subject: RE: Math: Removing X number of zeroes from number Y.
From: <tomas.vanek@xxxxxxxxxxxxx>
Date: Mon, 6 Jun 2005 16:55:44 +0200
number of zeroes
concat(substring($number, 1, string-length($number) - $decimal-point),
'.', substring($number, string-length($number) - $decimal-point))
(didn't debug it so this is just the idea)
Tomi

-----Original Message-----
From: Ahsan Ali [mailto:doubleletter@xxxxxxxxx]
Sent: Monday, June 06, 2005 4:30 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject:  Math: Removing X number of zeroes from number Y.

Hi,

I have a fare element that is returned as, for example, 79000. The
decimal point value is specified in another element as for example 2.
Therefore the number should be: 790.00

There's a way to do this mathematically:

Where x=DecimalPoint, and y=fare, the forumla would be y/(10^x)

But as far as I know there's no exponential function in XSLT 1.0. I'm
using, or rather, _have_ to use MSXML, I can't go for FXSLT, etc.

It's worth mentioning that fare is of type 'double' and DecimalPoint is
of type 'short'

Anyone have any ideas on how to do this in plain XSL ?

Any help is appreciated,

Best Regards,

Ahsan

--
http://doubleletter.blogspot.com



This message is for the designated recipient only and may contain privileged,
proprietary, or otherwise private information.  If you have received it in
error, please notify the sender immediately and delete the original.  Any
other use of the email by you is prohibited.

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.