Despite explicitly renaming all child nodes of <doc/>, the former <a/> element is the only one to be renamed. The <b/> element is inserted within the same snapshot and is therefore not yet visible to the user.
[[Update#Returning Results|Returning Results]] shows how to access updated nodes and return query results.
===Returning Results===
It is not possible to mix different types of expressions in a query result. The outermost expression of a query must either be a collection of updating or non-updating expressions. Generally there There is no way to perform any updating queries and return a result at the same time, except for using the BaseX-specific [[Database Module#db:output|db:output()]] function, which caches the results of its argument arguments at runtime and returns it after all updates have been processed.
Trying to modify and return a DOM node within the same snapshot is another story. As changes on DOM nodes are non-persistent, you cannot access them in a subsequent query. This is where the [[Update#transform|transform expression]] comes into play.
===Function Declaration===
To use updating expressions within a function, the 'updating' flag has to be added to the function declaration. A correct declaration of a function that contains updating expressions (or one that calls updating functions) looks like this: