Name
cx:namespace-delete — Delete namespace declarations.
Synopsis
<p:declare-step
type
="
cx:namespace-delete
"
xmlns:cx
="
http://xmlcalabash.com/ns/extensions
"
>
<p:input
port
="
source
"
/>
<p:output
port
="
result
"
/>
<p:option
name
="
prefixes
"
/>
<!--
ListOfStrings -->
</p:declare-step>
Description
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
“ns1
” prefix,
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.
Note
Removing namespace declarations from attributes can
introduce well-formedness problems. For example, if the
“para
” element in the example had
an 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: