This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: complex functions on subtrees.
- From: "Michael Kay" <michael dot h dot kay at ntlworld dot com>
- To: <xsl-list at lists dot mulberrytech dot com>
- Date: Thu, 28 Mar 2002 09:55:46 -0000
- Subject: RE: [xsl] complex functions on subtrees.
- Reply-to: xsl-list at lists dot mulberrytech dot com
Yes, if the structure is fully marked-up then it should be possible to do
what you want in XSLT. It might be a good idea to use a processor that
offers stylesheet functions (xsl:function, EXSLT's func:function, or
similar). Saxon offers this extension and I think several other processors
do as well.
Michael Kay
Software AG
home: Michael.H.Kay@ntlworld.com
work: Michael.Kay@softwareag.com
> -----Original Message-----
> From: owner-xsl-list@lists.mulberrytech.com
> [mailto:owner-xsl-list@lists.mulberrytech.com]On Behalf Of croce
> Sent: 28 March 2002 09:29
> To: xsl-list@lists.mulberrytech.com
> Subject: [xsl] 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
>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list