Extra namespaces added when using the serialize function
we are trying to do an XML transform and when we call the serialization function to convert the XML result to a string we find some extra namespaces that we don't need. Could you please tell us how to get serialized result without additional namespaces. we are using the 10.4 release (saxon-ee-10.4.jar).
Please find attached the following:
- The input (payload.xml)
- The XSLT Map (Catalog_TO_GBO.xslt)
- The result (Result.xml) and a screenshot (Result.JPG) with the namespaces marked in yellow
Thank you in advance.
#1 Updated by Michael Kay 5 months ago
- Tracker changed from Bug to Support
- Status changed from New to In Progress
If you want to avoid these namespaces appearing in the result, then you must ensure that they are not present in the tree that you are serializing. They are there because the elements were constructed as literal result elements, and the rules for literal result elements are that they get a copy of all in-scope namespaces declared in the stylesheet unless specified otherwise.
I normally include
xsl:stylesheet element to prevent this happening. It's very rare that this will exclude any namespaces that you actually need.
Please register to edit this issue