Project

Profile

Help

Support #5433

closed

xsl:import/xsl:include Hierarchy Methodology

Added by Scott Louzon almost 2 years ago. Updated almost 2 years ago.

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

0%

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

Description

My team invokes Saxon through the command-line by passing in the XSL and XML files directly. I am running into the same issue described here: https://stackoverflow.com/questions/10096086/how-to-handle-duplicate-imports-in-xslt#comment126656138_10102298

I.e. I am using import, but I am receiving complaints when I am trying to encapsulate my XSL files and thus end up with the same file imported more then once. Saxon produces a warning and returns an error code killing my build.

Suppress the Error

My first route was to try and use the command-line switch -warnings:silent. It was basically stated this isn't uncommon behavior:

It's true enough that if A.xsl uses util.xsl and you want to reuse A.xsl in lots of places, then it can be convenient if A.xsl declares its dependency using an import or include declaration, which means that if B.xsl also uses util.xsl you will end up with this situation of multiple imports.

However I still see the warning and the error code. It was recommended to use ErrorListener or ErrorReporter to suppress this error. But, I am unsure how this can be possible when we invoke Saxon through the command-line, and don't use any Java.

Avoid Multiple Imports of the Same File

I tried the use of the use-when attribute on the import, with a combination of static variables, dummy functions and elements; trying to emulate ifndef in C, but to no avail. XSL packages where also recommend as a potential solution, but I haven't found a concrete example/description of how they would help.

Is there any guidance on how I can either:

  • Suppress the warning/error using a command-line setup that calls Saxon. Ideally only suppress this warning.
  • Avoid the error using a different methodology (packages?), while maintaining encapsulation for scalability.

Please register to edit this issue

Also available in: Atom PDF