Given:
<ml:define>
<ml:id xml:space="preserve" subscript="EPDM">cp</ml:id>
<ml:apply>
<ml:mult/>
<ml:real>1.00</ml:real>
<ml:apply>
<ml:div/>
<ml:id xml:space="preserve">kJ</ml:id>
<ml:apply>
<ml:mult/>
<ml:id xml:space="preserve">kg</ml:id>
<ml:id xml:space="preserve">K</ml:id>
</ml:apply>
</ml:apply>
</ml:apply>
</ml:define>
The algorithm might be:
search for <ml: define
take the next <ml:id tag as the left side of the assignment, add subscript="subscript" to the variable name
search for a <ml: apply tag and write the opening parenthesis for it
define an operator from <ml:mult <ml:div etc. -
use the following <ml:id tags concatenating using the operator
search for the closing of the</ ml: apply tag and write the closing parentheses
Since the ml: apply tags are nestetd using xslt might not be possibl straighforwardly...