I am using xslt transformations on my current project. The original xslts were written in stylesheet 1.0 format. The project is run on Apache Tomcat server. In the output logs from the server, the warning:
Warning: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor
is constantly printing to the std out logs from Tomcat. I tried changing the stylesheet version number to "2.0" but parts of my project is not getting the correct data after the to the transformer. Only reason why I wish to fix this issue is because the log file is taking up too much memory space. So does anybody know how to suppress the warning for specific Tomcat server? Suppressing this one specific warning would be preferred but any opinions is much appreciated. Thank you.
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 most often used to convert data between different XML schemas or to convert XML data into web pages or PDF documents.
Specifies the format pattern. Here are some of the characters used in the formatting pattern: 0 (Digit) # (Digit, zero shows as absent)
Can't you run the transformation with an XSLT 1.0 processor?
If the answer is negative, then it is not a good idea to run an XSLT 1.0 transformation with an XSLT 2.0 processor.
My recommendation is to change the version attribute of <xsl:stylesheet>
to 2.0 and to debug the code so that the correct results are produced. This eliminates the warning and also any bad side efects of the backwards compatibility mode (such as still using the XPath 2.0 XDM).
In case you're using Saxon 8+ XSLT 2.0 processor, you can suppress this warning when invoking the Transformer like this:
TransformerFactory tf = TransformerFactory.newInstance();
tf.setAttribute("http://saxon.sf.net/feature/version-warning", Boolean.FALSE);
Transformer t = tf.newTransformer();
t.transform(xmlSource, outputTarget);
In case you're getting the error in XMLUnit, you can set XSLT version to 2.0 like this:
XMLUnit.setXSLTVersion("2.0");
Note:
For command-line Saxon invocation, run Saxon like this: saxon -versionmsg:off
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