Project

Profile

Help

Storing saxon:expression

Added by Anonymous over 16 years ago

Legacy ID: #4667229 Legacy Poster: Freek Segers (freeksegers)

Hi, I'm trying to optimize an XSLT that needs to apply a lot of external XPath expression multiple times. In the example of saxon:epxression() I saw that it's possible to store the compiled expression in a variable. I tried to store my expressions in a temporary tree inside a variable like: <xpath @key="{$key}"> <xsl:copy-of select="saxon:expression(XPath)"/> </xpath> When I try to eval the xpath I get an error SXXF0001: First argument to saxon:eval must be an expression prepared using saxon:expression Can I store my expressions in some other way? Thanks, Freek Segers


Replies (1)

RE: Storing saxon:expression - Added by Anonymous over 16 years ago

Legacy ID: #4667286 Legacy Poster: Michael Kay (mhkay)

You can save the expression in a variable like this: <xsl:variable name="x" select="saxon:expression(XPath)"/> You can't put objects like this into the nodes of a tree - that has the effect of converting them to character strings, which loses all the useful information.

    (1-1/1)

    Please register to reply