I have this 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>
So, I want to copy everything but certain nodes based on a regex expression. And I want to use the matches function of XSLT 2 to achieve this. But when I run the following command:
xsltproc.exe style.xsl input.xml > output.xml
I got this message looped on the standard output:
xmlXPathCompOpEval: function matches not found
XPath error : Unregistered function
xmlXPathCompiledEval: 1 object left on the stack
How to fix this please ?
Thanks very much.
The XSLT 2.0 engine is backwards compatible. The only time the backwards compatibility of the XSLT 2.0 engine comes into effect is when using the XSLT 2.0 engine to process an XSLT 1.0 stylesheet.
XSLT is designed to be used as part of XSL. In addition to XSLT, XSL includes an XML vocabulary for specifying formatting. XSL specifies the styling of an XML document by using XSLT to describe how the document is transformed into another XML document that uses the formatting vocabulary.
Transform JSON using XSLTOxygen makes it possible to transform JSON documents to XML or HTML through XSLT processing. A few predefined document templates are even available to help you define the XSLT necessary for the processing.
You will need to use an XSLT 2.0 processor like Saxon 9 or the other options listed on https://stackoverflow.com/tags/xslt-2.0/info, xsltproc is an XSLT 1.0 processor.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With