Evaluate a string-expression in XSL

这一生的挚爱 提交于 2019-12-13 00:06:49

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/3070575/evaluate-a-string-expression-in-xsl

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!