Running this code
copy $foo := <foo />
modify (
insert node <bar /> into $foo
)
return $foo
in Saxon-EE 9.6.0.7 (form Oxygen 18) I get the Error
Target node of insert expression is not updateable
BaseX returns <foo><bar/></foo>
Who is right? Is there another way to modify any xml-expression, not just those loaded by doc() (which works with Saxon)?
You need to set the option -tree:linked
to ensure that Saxon runs using an updatable tree model. The default tree model is immutable.