我有一个xslt syltesheet:
<?xml version="1.0"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes" />
<xsl:strip-space elements="*" />
<!-- Default behavior: copy everything -->
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()" />
</xsl:copy>
</xsl:template>
<!-- Do not copy: -->
<xsl:template match="NodeLevel1[matches(NodeLevel2/@Param1, 'myRegex')]">
</xsl:template>
</xsl:stylesheet>
所以,除了基于正则表达式的某些节点之外,我想复制所有内容。我想使用xslt 2的matches函数来实现这一点。但当我运行以下命令时:
xsltproc.exe style.xsl input.xml > output.xml
我在标准输出中循环了这个消息:
xmlXPathCompOpEval: function matches not found
XPath error : Unregistered function
xmlXPathCompiledEval: 1 object left on the stack
请问怎么修?
非常感谢。
最佳答案
您需要使用xslt 2.0处理器,如saxon 9或https://stackoverflow.com/tags/xslt-2.0/info中列出的其他选项,xsltproc是xslt 1.0处理器。