xsl-list
[Top] [All Lists]

[xsl] [XSLT]: Recursive Function to Add/Multiply

2006-10-09 01:24:27
Hi everybody,

I have the following XML file, which represents expressions with "+" and "*"

artihmentic operands:
<m value="10">
 <i value="5"/>
 <m value="10">
    <i value="2"/>
    <i value="2"/>
    <i value="2"/>
 </m>
</m>

This represents the following expression:

10 * (5 + (10 * (2 + 2 + 2)))

I want to compute the expression's value (for the given example, the
result should be 650).

Can anyone help me achieve this through a single recursive template?

Many thanks to you all!

Nuno

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>