functx:change-element-ns
Changes the namespace of XML elements
Description
The functx:change-element-ns function changes the namespace of one or more elements in $elements to $newns. It does not change the namespace of their descendant elements; see the functx:change-element-ns-deep function for that purpose.
Parameters |
Description |
---|---|
elements:element() |
the elements to change |
newns:string() |
the new namespace |
prefix:string() |
the prefix to use for the new namespace |
Examples
XPath |
Results |
---|---|
functx:change-element-ns($in-xml, ‘http://foo’,’’) |
<a xmlns=”http://foo”> <bar:b xmlns:bar=”http://bar”>557</bar:b> <bar:c xmlns:bar=”http://bar”>xyz</bar:c> </a> |
functx:change-element-ns($in-xml, ‘http://foo’,’foo’) |
<foo:a xmlns:foo=”http://foo”> <bar:b xmlns:bar=”http://bar”>557</bar:b> <bar:c xmlns:bar=”http://bar”>xyz</bar:c> </foo:a> |