Puneet Pant
Puneet Pant

Reputation: 1048

How to prevent xdmp:node-replace from adding a namespace declaration?

I want to use xdmp:node-replace to replace a node in my xml document. But, whenever it replaces a node it inserts a blank xmlns tag to that node. How to avoid it?

Upvotes: 3

Views: 469

Answers (1)

Ghislain Fourny
Ghislain Fourny

Reputation: 7279

A blank xmlns tag means that the default namespace is undeclared.

If the new node has no prefix and is in no namespace, and the parent node has a default namespace in its scope, this sounds like correct behavior, for example:

<parent xmlns="http://www.example.com/">
  <new-node xmlns=""/>
</parent>

Have you tried replacing with a node that is in the default namespace in scope for the parent? Then I would expect the following result (new-node is in the http://www.example.com/ namespace):

<parent xmlns="http://www.example.com/">
  <new-node/>
</parent>

Upvotes: 1

Related Questions