xsl-list
[Top] [All Lists]

Re: exponential math functions in xslt

2002-09-19 12:27:53

--- "J.Pietschmann" <j3322ptm at yahoo dot de> wrote:
 
Kuhn, Allen wrote:

Does xslt have functions for doing exponential calculations?

I'm not aware of a built-in function (either in XPath
or as an XSLT function). You can check the EXSLT math
module, which is supported by many processors, check
the list of extension functions your processor offers,
check whether you can call it from the underlying
system, or, if all else fails, get a book about numerical
calculations and implement it yourself in XSLT. It's not
all that hard unless you want to have high accuracy and/or
high performance.

J.Pietschmann

The FXSL library has pure XSLT 1.0 implementations of the following
exp/log functions:

exp(), 

ln(), log10(), log2()

log(),

pow()

Therefore, it is not at all necessary to look for extension functions,
which will inevitably affect the portability of the application using
them.

As for another myth -- that extension functions are significantly
faster, I recently performed detailed timing in an XSLT application, in
which ln() was computed approx. 5000 times. Substitution of the FXSL
"ln" template with calls to a Javascript extension function led to less
than 10% increase of the speed. My decision, therefore, was not to use
the Javascript extension function, as the loss of portability was not
justified by the very minor increase in speed.

For more information see:

"An XSL Calculator: The Math Modules of FXSL",
 
http://fxsl.sourceforge.net/articles/xslCalculator/The%20FXSL%20Calculator.html#3._The_Exponential_and_Logarithmic_Functions




Hope this helped.

=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL


__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list