Yes you did get it right and I did try the query though sadly java runs out of memory.
In that case, you could try to create a database of your document and run the update operations directly on that database..
1. open your database 2. run the query:
for $e in //* let $m := $e/@mark return if($m) then ( delete node $m, (: [.] is same as: where $d ne "" :) for $d in data($m)[.] return ( delete node $e/text(), insert node $d as first into $e ) ) else ( delete node $e )
If that doesn’t help…
1. delete all nodes without @mark attribute 2. optimize your database and 3. rewrite nodes with the @mark attribute
I rather not prune my xml because It's around 5GB.
What do you mean by pruning?