This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
complex functions on subtrees.
Hi,
I'm willing to do some complex transformations/queries on subtrees,
such as examening an expression and retrieving the coefficient
(nominator,denominator) of a variable or retrieving the constant term
(nominator,denominator).
<exp>/
<exp>+
<exp>*
<var>a</var>
<const>3</const>
</exp>
<const>5</const>
</exp>
<const>7</const>
</exp>
or thus the expression (3a+5)/7. ( coeff(a)=3/7, constant term=5/7 )
It would be a fair assumption that the expressions are linear expressions,
note however that expressions like
5*((3a+5b)/3+a/4) are also possible and queries on them require some
calculations.
Would or would not be XSLT a good tool for that? (I suppose there are
better...)
I'm using XSLT because this is only a part of a bigger transformation.
Is it possible to arrive (within XSLT) to an expression node, p.e. by means
of <xsl:apply-templates select="exp">
and call from within that template a non-xsl function to examen the current
node "." (this node is off course an <exp>subtree)
<xsl:template match="exp">
<xsl:value-of select="myfuction_getcoeff(.,'a')">
</xsl:template>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list