Thank you, Christian, now I understand! Incidentally, nevertheless I am not sure the following behaviour is correct: basex "<_ xmlns='bar'>{element foo {namespace {''} {'bar'}}}</_>/*"=> [XQDY0102] Duplicate namespace declaration: ''. As the dynamic constructor is located in a static context with a default namespace, the foo should be interpreted as a name in that namespace, thus "if the name of an element in an element constructor is in no namespace" does not apply. Cordial greetings,Hans-Jürgen PS: By contrast, this works:basex "<_ xmlns='bar'>{<foo/>}</_>/*" =><foo xmlns="bar"/> PPS: And this also works:basex "<_ xmlns:f='bar'>{element f:foo {namespace {'f'} {'bar'}}}</_>/*" => <f:foo xmlns:f="bar"/>
Am Sonntag, 30. Januar 2022, 17:54:24 MEZ hat Christian Grün christian.gruen@gmail.com Folgendes geschrieben:
Hi Hans-Jürgen,
basex "<foo>{namespace {''}{'bar'}}</foo>" => [XQDY0102] Duplicate namespace declaration: ''.
This is expected. The specification states that “[…] if the name of an element in an element constructor is in no namespace, creating a default namespace for that element using a computed namespace constructor is an error [err:XQDY0102]”
You’ll need to include a (static) namespace URI as part of the direct element constructor:
<foo xmlns='bar'/>
Best, Christian
[1] https://www.w3.org/TR/xquery-31/#id-ns-nodes-on-elements