Hi Martin, Christian,

thanks a lot for clarification on this.

Usually, this is not a big deal: If you insert elements with new
namespaces, or if you insert child element with namespaces that
overwrite namespaces of parent elements, new namespaces will
implicitly be added to your XML fragment:  

Doh! That slipped my mind. Facepalm! ;-)

Just a side note: Due to the functional nature of the language, it is
never possible with XQuery to modify identities.  

Right. 

On Wed, Sep 11, 2019 at 10:38 AM Christian Grün <christian.gruen@gmail.com> wrote:
Hi Andreas,

As Martin stated (thanks!), the official spec provides no way to
delete existing namespaces. It not possible either to insert
namespaces that won’t be used.

Usually, this is not a big deal: If you insert elements with new
namespaces, or if you insert child element with namespaces that
overwrite namespaces of parent elements, new namespaces will
implicitly be added to your XML fragment:

  declare namespace lipsum = 'lorem-ipsum';
  copy $c := <lorem/>
  modify insert node <lipsum:new/> into $c
  return $c

> So it seems, I must give the node a new identity instead of just modifying the old identity.

Just a side note: Due to the functional nature of the language, it is
never possible with XQuery to modify identities. You will always get
copies of your original data (that may eventually replace your old
data, e.g. in the database).

Hope this helps,
Christian



On Tue, Sep 10, 2019 at 11:35 PM Martin Honnen <martin.honnen@gmx.de> wrote:
>
> On 10.09.2019 03:50, Andreas Mixich wrote:
> >
> > adding to my last email: of course, this way I still did not solve
> > addition of more namespaces. Any ideas on that?
> >
> > modify insert node namespace {"foo"} {"foobar"} into $c/self::node()
> >
> > Because, even if I reconstruct the node completely, with the
> > non-updating expressions, I would not know any other syntax, that would
> > match the purpose.
>
> Let's hope that Christian or others can give you some insight on that, I
> can't get any handle on how to figure where/how the XQuery update spec
> or implementations allow deletion or insertion of namespaces. I found
> one question on StackOverflow answered by Christian that suggested that
> deletion is not possible with XQuery update.
>


--
Minden jót, all the best, Alles Gute,
Andreas Mixich