Support #5692
closed

Warning for xslt included or imported more than once
0%
Description
Hello,
is there a way to desactivate the warnings about xslt included or imported more than once :
For example : 2022-09-20 08:41:38,492 [main] WARN eu.els.sie.saxon.utils.Log4jStandardErrorListener - Warning at xsl:stylesheet on line 9 column 17 of els-common_constants.xsl: Stylesheet module cp:/xslLib/els-common_constants.xsl is included or imported more than once. This is permitted, but may lead to errors or unexpected behavior
I tried even a log4j2 regex filter but not working because of non regular carriage return chars in the message.
Thanks
Updated by Michael Kay about 1 year ago
Given a s9api XsltCompiler, you can do something like:
ErrorReporter reporter = xsltCompiler.getErrorReporter();
xsltCompiler.setErrorReporter(
error -> {
if (!(error.isWarning() && error.getMessage().contains("is included or imported more than once")) {
reporter.report(error);
}
};)
We should do better at making sure all warnings have an error code, which would give you a more reliable way of filtering them.
Updated by Michael Kay about 1 year ago
- Status changed from New to Closed
For Saxon 12 I have done some extensive tidying up so (a) all internal APIs for reporting warnings allow an error code to be reported, (b) most warning messages now carry an error code, and (c) the standard error reporter has a suppressWarnings() method that allows specific error codes to be suppressed.
Please register to edit this issue