Bug #5480


Saxon EE Adding Extraneous namespaces to each ancestor node, i.e. xmlns=""

Added by John Crane 6 days ago. Updated 5 days ago.

Start date:
Due date:
% Done:


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


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.


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
Actions #1

Updated by O'Neil Delpratt 6 days ago

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

Updated by Martin Honnen 5 days 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 5 days 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 5 days 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.

Please register to edit this issue

Also available in: Atom PDF