Project

Profile

Help

Support #5692

closed

Warning for xslt included or imported more than once

Added by hamdi karray over 1 year ago. Updated over 1 year ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
-
Sprint/Milestone:
-
Start date:
2022-09-20
Due date:
% Done:

0%

Estimated time:
Legacy ID:
Applies to branch:
Fix Committed on Branch:
Fixed in Maintenance Release:
Platforms:

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

Actions #1

Updated by Michael Kay over 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.

Actions #2

Updated by Michael Kay over 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

Also available in: Atom PDF