Project

Profile

Help

Bug #5480

closed

Saxon (10 on .NET) Adding Extraneous namespaces to each ancestor node, i.e. xmlns=""

Added by John Crane over 2 years ago. Updated over 2 years ago.

Status:
Duplicate
Priority:
High
Assignee:
-
Category:
.NET API
Sprint/Milestone:
-
Start date:
2022-05-10
Due date:
% Done:

0%

Estimated time:
Legacy ID:
Applies to branch:
Fix Committed on Branch:
Fixed in Maintenance Release:
Platforms:
.NET

Description

Hi There - we are using Saxon EE 10.6.0 for .NET framework and having an issue with extraneous namespaces in the result-document output when transforming xml.

We have several XSLTs that transform XML which worked properly with Saxon EE 9.6, but with 10.6 we're getting extraneous href attributes added to each node, i.e. <... xmlns="">. When processed using 9.6, the results look correct. We are using a namespace-aware DOM to load the XML, so the issue is unrlated to that.

If anyone knows of a configuration setting or other change that would prevent those hrefs from appearing in each ancestor node it would be most appreciated.

Attached is an exammple of the xsl we are using.


Files

Sample_Transform_XSLT.xsl (4.82 KB) Sample_Transform_XSLT.xsl Example Transform XSLT John Crane, 2022-05-10 15:59
SaxonSampleCode.cs (5.29 KB) SaxonSampleCode.cs John Crane, 2022-05-11 17:17

Related issues

Is duplicate of Saxon - Bug #5565: Saxon-HE 10N: Extra namespaces on every node when serializing into XmlWriterClosedO'Neil Delpratt2022-06-14

Actions
Actions #1

Updated by O'Neil Delpratt over 2 years ago

  • Project changed from SaxonC to Saxon
  • Category set to .NET API
  • Found in version deleted (10.6)
Actions #2

Updated by Martin Honnen over 2 years ago

Can you add a small but representative XML input sample you process with the stylesheet you have already attached? It would also help if you show the relevant .NET (e.g. C#) code you use to run the transformation.

Actions #3

Updated by John Crane over 2 years ago

Hi All,

Thanks for looking at this issue so quickly. I think we have discovered the error we were making, and now have transforms working correctly.

When doing the transform, we were previously using a DomDestination object for the results. We changed that to an XdmDestination type, which seems to have resolved our issue.

Attached is a sample of the code we are using - this is from a test application, the actual code is a bit more complicated - but this shows essence of the transform we are doing. Unfortunately the XML is quite long and not easily modified for sharing.

You can see the older DomDestination references are commented out - the uncommented code is what is now working. We've done preliminary tests that look good, and will continue to do more.

I think we have the issue resolved - but if you have any feedback on the code or suggestions in general we'd certainly appreciate them.

Many thanks again for looking so quickly. Incidentally, I meant to enter this as 'Support' - once I hit submit it was too late...

John C

Actions #4

Updated by Michael Kay over 2 years ago

@John, for your reference Martin Honnen is a friendly user who solves a lot of bugs before we get to them (and also raises quite a few). Your thanks go to him and not to Saxonica!

You should definitely avoid using the DOM with Saxon unless you really need it, for performance reasons. If you want serialized output, use a Serializer as the destination.

But we'll keep the bug open, because we need to see why it isn't working properly with a DOM destination. We should be eliminating redundant namespace declarations when writing to the DOM tree.

Actions #5

Updated by Michael Kay over 2 years ago

Thanks for adding the C# code sample, but to be able to reproduce this, I also need an XML source document.

It's unlikely we will make any changes on the 10.x branch at this stage, but I would like to check that it's fixed in 11.x. We've got unit tests that I would expect to show up any problems, but the devil is always in the detail.

Actions #6

Updated by Michael Kay over 2 years ago

  • Subject changed from Saxon EE Adding Extraneous namespaces to each ancestor node, i.e. xmlns="" to Saxon (10 on .NET) Adding Extraneous namespaces to each ancestor node, i.e. xmlns=""
Actions #7

Updated by Michael Kay over 2 years ago

  • Status changed from New to Duplicate

Probably a duplicate of #5565

Actions #8

Updated by Michael Kay over 2 years ago

  • Is duplicate of Bug #5565: Saxon-HE 10N: Extra namespaces on every node when serializing into XmlWriter added

Please register to edit this issue

Also available in: Atom PDF