Copy-namespaces declaration
The copy-namespaces mode controls the namespace bindings that are assigned when an existing element node is copied by an element constructor.
In Db2 XQuery, the copy-namespaces mode is always preserve and inherit. The setting preserve specifies that all in-scope-namespaces of the original element are retained in the new copy. The default namespace is treated like any other namespace binding: the copied node preserves its default namespace or absence of a default namespace. The setting inherit specifies that the copied node inherits in-scope namespaces from the constructed node. In case of a conflict, the namespace bindings that were preserved from the original node take precedence.
A copy-namespaces declaration that specifies values other than preserve and inherit results in an error. The prolog can contain only one copy-namespaces declaration for a query.
Syntax
- preserve
- Specifies that all in-scope namespaces of the original element are retained in the new copy.
- inherit
- Specifies that the copied node inherits in-scope namespaces from the constructed node.
Example
The following copy-namespace declaration is valid, but does not change the default behavior for element construction:
declare copy-namespaces preserve, inherit;