When renaming non-prefixed attributes using the update facility, an XUDY0023 error ("namespace conflict") is triggered if the containing element is living in a (non-empty) default namespace.
Example:
<foo xmlns="urn:x" bar="2" />
transform with {
for $a in .//@bar return rename node $a as 'baz'
}
(: yields [XUDY0023] Namespace conflicts: baz vs. Q{urn:x}. :)
Expected Behavior
Since attributes are not affected by default namespace declarations, there is no conflict here; no error should be triggered. The expected result is
<foo xmlns="urn:x" baz="2" />
Steps to Reproduce the Behavior
The query above directly demonstrates the behvior.
For further consideration:
It is possible to write the desired transformation by using replace instead of rename. The following query works without error and may be used as a workaround:
<foo xmlns="urn:x" bar="2" />
transform with {
for $a in .//@bar return replace node $a with attribute {'baz'} { $a }
}
Correctly returns
<foo xmlns="urn:x" baz="2" />
Do you have an idea how to solve the issue?
Renaming attribute nodes must probably be special-cased, as the usual assumptions about declared default namespaces do not apply to them.
Description of the Problem
When renaming non-prefixed attributes using the update facility, an XUDY0023 error ("namespace conflict") is triggered if the containing element is living in a (non-empty) default namespace.
Example:
Expected Behavior
Since attributes are not affected by default namespace declarations, there is no conflict here; no error should be triggered. The expected result is
Steps to Reproduce the Behavior
The query above directly demonstrates the behvior.
For further consideration:
It is possible to write the desired transformation by using replace instead of rename. The following query works without error and may be used as a workaround:
Correctly returns
Do you have an idea how to solve the issue?
Renaming attribute nodes must probably be special-cased, as the usual assumptions about declared default namespaces do not apply to them.
What is your configuration?
BaseX 10.5