On 14.07.2021 20:48, Roger L Costello costello@xxxxxxxxx wrote:
<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.
|