GROOVY-6274: replaceNode improvements for XML processing