Bug #4323


ErrorListener for schema compilation invoked by xsl:import-schema

Added by Michael Kay over 2 years ago. Updated over 1 year ago.

Start date:
Due date:
% Done:


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



It seems that when xsl:import-schema triggers the compilation of a schema, the ErrorListener used for the XSLT compilation isn't inherited by the schema compilation.

Should check whether this also applies to the XQuery "import schema" declaration.

Actions #1

Updated by Michael Kay over 2 years ago

I've created a JUnit test case: TestXsltCompiler/testErrorNotificationFromImportSchemaError

This is showing up another related problem: the URIResolver registered with the XsltCompiler is not being used to resolve the schema-location appearing in xsl:import-schema. I'm not sure there's any specification that says it should be so used, but it seems a reasonable expectation.

Note that this doesn't apply to JAXP, where it's not possible to specify an ErrorListener or URIResolver at the level of an individual stylesheet compilation, they can only be specified at global (factory) level.

Actions #2

Updated by Michael Kay about 2 years ago

Not sure why this was dropped.

It seems a series of new JUnit tests were added to TestXsltCompiler on the 9.9 branch, some of which aren't passing. The tests weren't copied over to the 10.0 branch; I've now done that, and the same situation applies.

Actions #3

Updated by Michael Kay about 2 years ago

The test testErrorNotificationFromImportSchemaError, although it passes, is not achieving the desired effect. Rather, it reveals that the URIResolver registered with the XsltCompiler is not being used to resolve the schemaLocation appearing in the xsl:import-schema declaration. The Javadoc for XsltCompiler.setURIResolver() says clearly that it should be used, so I will change this.

With this fixed, the actual error in the schema (an invalid QName) is notified to the StandardErrorReporter, and the final "schema compilation has failed" is reported to the XsltCompiler's errorListener. This is still wrong; both should go to the XsltCompiler's errorListener. That requires a simple change to the way XslImportSchema sets up its PipelineConfiguration. This works. And it still works when I change the test to use XsltCompiler.setErrorList() to capture the errors.

With some corrections to the test, testErrorNotificationFromInlineSchemaError also now passes.

Actions #4

Updated by Michael Kay about 2 years ago

  • Status changed from New to Resolved
  • Applies to branch 10, 9.9 added
  • Fix Committed on Branch 10, 9.9 added

Fixed. Note there might be an effect on existing applications, but the change brings the code into line with the API documentation.

Actions #5

Updated by O'Neil Delpratt about 2 years ago

  • % Done changed from 0 to 100
  • Fixed in Maintenance Release 10.1 added

Bug fix committed in the Saxon 10.1 maintenance release.

Actions #6

Updated by O'Neil Delpratt over 1 year ago

  • Status changed from Resolved to Closed
  • Fixed in Maintenance Release 10.2, added
  • Fixed in Maintenance Release deleted (10.1)

Bug fix applied on the Saxon maintenance release.

Please register to edit this issue

Also available in: Atom PDF