cx:namespace-delete — Delete namespace declarations.
This step aggressively removes all of the
namespaces identified by the specified prefixes from the document. The
prefixes must be in-scope at the point where the
cx:namespace-delete element occurs.
Consider this document:
If the following step is used to remove the
the resulting document will be:
Observe that the namespace declaration has been stripped off both elements and attributes. If prefixes occur in places, such as attribute values or text content, not “visible” to the XML specification, they are not changed.
Removing namespace declarations from attributes can
introduce well-formedness problems. For example, if the
para” element in the example had
attr attribute in no namespace, deleting
ns1” would leave two attributes with the
same name on the element. This is not well-formed and the step would fail.
This problem can be addressed by first deleting the offending attributes, perhaps like so: