Bug #3364
closedInternal error: Cannot check template params before target template is compiled.
100%
Description
Hi,
I’ve been trying the latest Saxon 9.8.0.2 .Net Nuget and I’ve come across a couple of bugs. The attached files re-produce the errors.
The first one is an issue that causes the context to be lost if a trace listener is added.
The second is a validation issue that occurs when the sample xsl file is imported multiple times (previously this raised a warning and then ran OK, now it causes an internal error).
Both these tests worked on older versions of the saxon libs.
To see the issues build the Visual Studio solution in the attached zip and then run the RunTests.bat (some comments in the batch file explain the errors).
Files
Updated by Michael Kay over 7 years ago
- Priority changed from High to Normal
The first bug has been logged under issue #3365.
The second (this one) has also been reported by T. Hatanaka in direct mails dated 18 July and 24 July and may be easier to reproduce using the samples attached to those report.
Updated by Michael Kay over 7 years ago
What happens when a stylesheet is imported more than once is that we create two components with different import precedence but pointing to the same source code (specifically, StyleElement node in the stylesheet tree). When we compile components, we set a flag "compile action completed" which prevents a component being processed twice; but this flag is set in the StyleElement, not in the component, so the second component is not processed. But the two template components point to different NamedTemplate objects containing the compiled code, and so one of these NamedTemplate objects has a null body because the compilation wasn't carried out.
Updated by Michael Kay over 7 years ago
More precisely: there is one XSLTemplate object, but because there are two "declarations" (with the same source code but difference precedence) we call the index() method twice, and when we call the index() method, we create a new NamedTemplate object and update the value of XSLTemplate.compiledNamedTemplate to point to it. So we have created two NamedTemplate objects, and because of the (somewhat random) order of processing, the CallTemplate instruction points to the one that was abandoned and overwritten.
The index() method contains a chunk of commented-out code saying:
// Following change was attempted to fix a problem with multiple includes, but
// it caused other tests to crash e.g. apply-imports-001. MHK 2017-03-07
so it looks like we've been here before.
Updated by Michael Kay over 7 years ago
- Subject changed from Critical Internal error: Cannot check template params before target template is compiled. to Internal error: Cannot check template params before target template is compiled.
- Category set to XSLT conformance
- Status changed from New to Resolved
- Assignee set to Michael Kay
- Applies to branch 9.8 added
- Fix Committed on Branch 9.8 added
Patch tested and committed on the 9.8 branch.
Updated by O'Neil Delpratt over 7 years ago
- Status changed from Resolved to Closed
- % Done changed from 0 to 100
- Fixed in Maintenance Release 9.8.0.4 added
Bug fix applied in the Saxon 9.8.0.4 maintenance release.
Please register to edit this issue