tags:

views:

28

answers:

1

Is there any way to evaluate a string expression in XSL?

example:

<myItem id="1">
    <validator expression="$someVariable = '3'" />
</myItem>

...
<xsl:variable name="someVariable" select="3" />
<xsl:if test="@expression"> ...

I realize this syntax does not work the way I want it to, but is there any way to store the test expression in a variable and then evaluate the expression?

A: 

A dynamic evaluate did not make it into XSLT 2.0, according to Michael Kay (XSLT 2.0 and XPath 2.0, 4th ed. p 1210)

There is a dyn:evaluate() function in EXSLT, which is also implemented in Saxon.

Jim Garrison