Project

Profile

Help

Bug #5861

closed

xsl:copy-of copy-namespaces="no" fails with various tree models

Added by Michael Kay over 1 year ago. Updated about 1 year ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
XSLT conformance
Sprint/Milestone:
-
Start date:
2023-01-27
Due date:
% Done:

100%

Estimated time:
Legacy ID:
Applies to branch:
10, 11, 12, trunk
Fix Committed on Branch:
10, 11, 12, trunk
Fixed in Maintenance Release:
Platforms:
.NET, Java

Description

New unit test added to ObjectModelTests.java to test xsl:copy-of with assorted tree models.

The test with copy-namespaces="no" is crashing with the Linked Tree model. The test was prompted by bug #5859 (using the DOM model) and the failure will probably occur with any tree model that uses the generic Navigator.copy() method.

Failure symptoms in 12.0:

java.lang.IllegalStateException: Prefix p has not been declared
	at net.sf.saxon.event.RegularSequenceChecker.startElement(RegularSequenceChecker.java:361)
	at net.sf.saxon.event.ComplexContentOutputter.startElement(ComplexContentOutputter.java:535)

The problem is that Navigator.copy() (with copy-namespaces="no") invokes the 6-argument ComplexContentOutputter.startElement() method with an empty namespace map; this method does not do namespace fixup, so the namespaces that are actually used in the element and attribute names do not get declared.

Actions #1

Updated by Michael Kay over 1 year ago

  • Subject changed from xsl:copy-of copy-namespaces="no" fails with linked tree model to xsl:copy-of copy-namespaces="no" fails with various tree models

It fails with the LinkedTree, but this has its own implementation of ElementImpl.copy() which needs to be fixed separately,

Actions #2

Updated by Michael Kay over 1 year ago

After changing Navigator.copy() to gather the namespaces used on the element being copied and its attributes, the new tests are working for all tree models except the LinkedTree.

Actions #3

Updated by Michael Kay over 1 year ago

Now fixed for the LinkedTree as well; new tests working on all tree models.

Need to

  1. regression test;
  2. back-port the bug fix and the tests to 11.x and 10.x branches
  3. port the test (and if necessary the bug fix) to SaxonCS.
Actions #4

Updated by Michael Kay over 1 year ago

  • Status changed from New to In Progress
Actions #5

Updated by Michael Kay over 1 year ago

  • Category changed from Internals to XSLT conformance
  • Fix Committed on Branch 10, 11, 12, trunk added
  • Platforms Java added

Fully resolved for SaxonJ.

Need to check for SaxonCS.

Actions #6

Updated by Michael Kay over 1 year ago

  • Status changed from In Progress to Resolved
  • Platforms .NET added

I have converted the JUnit ObjectModelTests to C# NUnit, with implementations for TinyTree, LinkedTree, Dom, and LINQ.

I'm seeing one or two failures - notably the DocumentOrder tests - but the XSLT copy-of tests are succeeding so we can now close this issue. (Note that the failure would have occurred before transpiling the code with the Java patches applied.)

Actions #7

Updated by Michael Kay over 1 year ago

Note, I haven't specifically tested on SaxonCS 11, but the changes to the Java code are exactly the same and I think we can be confident that it will work when transpiled.

Actions #8

Updated by O'Neil Delpratt over 1 year ago

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

Bug fix applied in the Saxon 11.5 maintenance release.

Actions #9

Updated by O'Neil Delpratt over 1 year ago

  • Fixed in Maintenance Release 10.9 added

Bug fix applied in the Saxon 10.9 maintenance release. Leaving bug issue marked as resolved until applied in the next Saxon 12 maintenance.release.

Actions #10

Updated by O'Neil Delpratt about 1 year ago

  • Status changed from Resolved to Closed
  • Fixed in Maintenance Release 12.1 added

Bug fix applied in the Saxon 12.1 maintenance release.

Please register to edit this issue

Also available in: Atom PDF