Now, why I am writing this post! Because XQuery 1.0 has no support for UPDATE Node or UPDATE Node Value function which is applicable in XQuery 3.0.
Below is what you can achieve in XQuery 3.0.
This is not possible in XQuery 1.0 or 1.1 hence I am putting my thoughts around it and presenting a utility module which I will keep on enhancing for other such functions. For now, this post is for UPDATE.
I have used recursion in XQuery to achieve this.
This really gets the work done. If you are looking for some additional options let me know. Hope this is helpful.
You can download the source code from here – Utility.