Subject: Re: [xsl] How to dynamically evaluate an equation in the input XML document? From: "Martin Honnen martin.honnen@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Wed, 14 Jul 2021 18:57:37 -0000 |
<Convert-to-Celsius> <equation>(Fahrenheit - 32) * (5/9)</equation> <variable> <name>Fahrenheit</name> <value>32</value> </variable> </Convert-to-Celsius>
<xsl:template match="*[equation]"> <xsl:evaluate xpath="fold-left(variable, equation => replace('/', ' div '), function($e, $v) { replace($e, $v/name, $v/value) })" context-item="()"/> </xsl:template>
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.
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] How to dynamically evaluate a, Roger L Costello cos | Thread | Re: [xsl] How to dynamically evalua, Dimitre Novatchev dn |
[xsl] How to dynamically evaluate a, Roger L Costello cos | Date | Re: [xsl] How to dynamically evalua, Dimitre Novatchev dn |
Month |