如果有人能帮助我找到一种将文本作为xpath表达式阅读的方法,我将非常感激
e.g。这是我的xml文档
<abc>
<XYZ>
<include>/citizen[./marital_status[text() ='married']]</include>
</XYZ>
</abc>
我正在写一个样式表
<xsl:template match="abc">
<xsl:call-template name="evaluate">
<xsl:with-param name="include">
<xsl:apply-templates select="$include"/>
</xsl:with-param>
</xsl:call-template>
</xsl:template>
这里的问题是<include>
元素的文本是我希望成为<xsl:apply-templates select="$include"/>
中的xpath表达式的东西。这将给我结婚的公民,但在这里我只是得到字符串"/citizen[./marital_status[text() ='married']]"
本身。有没有可行的方法呢?
提前致谢
答案 0 :(得分:1)
检查所选XSLT处理器中的可用内容:查看它是否具有某种xx:evaluate()扩展功能。如果没有,或者如果你想要一个可移植的解决方案,另一种方法是生成一个包含相关表达式的样式表(或样式表模块),然后编译并执行样式表。