[Top] [All Lists]

Re: [xsl] How to dynamically evaluate an equation in the input XML document?

2021-07-14 13:57:45
On 14.07.2021 20:48, Roger L Costello costello(_at_)mitre(_dot_)org wrote:
     <equation>(Fahrenheit - 32) * (5/9)</equation>

  <xsl:template match="*[equation]">
    <xsl:evaluate xpath="fold-left(variable, equation => replace('/', '
div '), function($e, $v) { replace($e, $v/name, $v/value) })"

seems to work but of course it all depends on the grammar of your
equation and the grammar for variables, the operators used and how to
"translate" them to XPath operators.
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com

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