Hi Graydon, You can use FLWOR expressions also with the update keyword: <xml><a>A</a></xml> update { for $a in ./a return replace node $a with $a/node() } A shorter (possibly cryptic) variant is to use the simple map operator (!): <xml><a>A</a></xml> update { a ! (replace node . with node()) } Hope this helps, Christian ________________________________ Von: Graydon Saunders via BaseX-Talk <basex-talk@mailman.uni-konstanz.de> Gesendet: Samstag, September 27, 2025 7:33:07 AM An: BaseX <basex-talk@mailman.uni-konstanz.de> Betreff: [basex-talk] replacing elements with their children using update Hello! So I can use copy $c := $test modify (for $each in $c/descendant::html:ins return replace node $each with $each/node()) return $c to unwrap all the html ins elements in some test HTML. If I try to do this using update (because I am under the perhaps mistaken impression that update can do the same things copy/modify/return can) $test update {replace node descendant::html:ins with 'CABBAGE'} works fine; the various ins elements are found and replaced. But if I want to replace that particular ins element with its children, there doesn't seem to be a way to specify the children; the context item is the value of $test, not whatever descendant ins element is being replaced. How could this be written using update? Can this be written using update? thanks! -- Graydon Saunders | graydonish@fastmail.com<mailto:graydonish@fastmail.com> Þæs oferéode, ðisses swá mæg. -- Deor ("That passed, so may this.")