Reputation: 1059
I am in a situation where I need to explicitly show the default namespace for one particular element in the output, other than the root. In my current solution, the default namespace is being shown on the root node.
In my XSLT I have added the namespace to the node where it is needed, but it is not being shown in the output.
<MessageParts xmlns="http://schemas.microsoft.com/dynamics/2011/01/documents/Message">
This namespace is the same as the root, so it is not being shown in the output. Is there a way to override this functionality, so it will still be shown?
Upvotes: 1
Views: 47
Reputation: 163498
There is no way of forcing the XSLT serializer to output redundant namespace declarations. The general idea with serialization rules is that if distinctions aren't visible to an application after parsing, then there's no point worrying about them. This also means, for example, that you have no control over the order of attributes on an element.
Technically in XSLT 1.0 you also get no control over the choice of namespace prefixes, but in practice all known XSLT processors respect your choice of prefixes.
Upvotes: 1