Bug #4937
closed
Extra NS declaration added by transformer
Applies to branch:
10, trunk
Fix Committed on Branch:
10, trunk
Fixed in Maintenance Release:
Description
<a xmlns='someNS' name='test'><b xmlns=''/></a>
is transformed into
<a xmlns='someNS' name='test'><b xmlns='' xmlns=''/></a>
which is not valid
org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 24; Attribute "xmlns" was already specified for element "b".
see test case attached.
That works fine with 9.9 (HE, EE)
java -cp saxon9he.jar;. testSaxonTransformer
but fails with 10.0-10.3 (HE, EE) also tried with EE 10.4
java -cp saxon-he-10.3.jar;. testSaxonTransformer
but the transformed is correct when I add another NS. Like:
<a xmlns='someNS' xmlns:z='z' name='test'><b xmlns=''/></a>
Files
- Category set to DOM Interface
- Status changed from New to In Progress
- Assignee set to Michael Kay
- Priority changed from Low to Normal
- Applies to branch trunk added
Thanks for reporting it.
Reproduced as JUnit test testNamespaceSerializationBug4937().
The error appears to be when combining two namespace maps (NamespaceMap.applyDifferences()
-- which is not actually DOM-specific code, though it's probably used rather differently when handling DOM input.). This ends up incorrectly generating an empty namespace map for element b, rather than a map containing the single namespace binding (""=""). This error is then compounded: because the namespace map is empty, the scan of attributes on element b doesn't check whether any of the attributes are actually namespaces, so it's processing xmlns:"" a second time as if it were an ordinary attribute.
I've applied a fix to NamespaceMap.applyDifferences()
on the 10.x branch which ensures this test now passes. However, the test passes on the 11.x branch without this change: I'm currently exploring why.
- Status changed from In Progress to Resolved
- Fix Committed on Branch 10, trunk added
It was working on the 11.x branch because my configuration settings meant I was picking up Xalan as the DOM identityTransformer. Fixed this, found the bug was still present, so I've applied the patch to both branches.
- Status changed from Resolved to Closed
- % Done changed from 0 to 100
- Fixed in Maintenance Release 10.5 added
Bug fix applied to Saxon 10.5 maintenance release.
Please register to edit this issue
Also available in: Atom
PDF