Project

Profile

Help

Bug #4323

closed

ErrorListener for schema compilation invoked by xsl:import-schema

Added by Michael Kay about 5 years ago. Updated about 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Diagnostics
Sprint/Milestone:
-
Start date:
2019-09-27
Due date:
% Done:

100%

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

Description

See https://saxonica.plan.io/boards/3/topics/7602?r=7603

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 about 5 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 over 4 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 over 4 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 over 4 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 over 4 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 about 4 years ago

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

Bug fix applied on the Saxon 9.9.1.8 maintenance release.

Please register to edit this issue

Also available in: Atom PDF