mik*_*u95 13 regex xml xslt xpath
我有这个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>
Run Code Online (Sandbox Code Playgroud)
所以,我想基于正则表达式复制除了某些节点之外的所有节点.我想使用XSLT 2的匹配功能来实现这一点.但是当我运行以下命令时:
xsltproc.exe style.xsl input.xml > output.xml
Run Code Online (Sandbox Code Playgroud)
我在标准输出上循环了这条消息:
xmlXPathCompOpEval: function matches not found
XPath error : Unregistered function
xmlXPathCompiledEval: 1 object left on the stack
Run Code Online (Sandbox Code Playgroud)
如何解决这个问题?
非常感谢.
Mar*_*nen 13
您需要使用像Saxon 9这样的XSLT 2.0处理器或https://stackoverflow.com/tags/xslt-2.0/info上列出的其他选项,xsltproc是一个XSLT 1.0处理器.