Moving xml nodes up/down

I’ve been trying forever to get this to work…

Given a dynamically generated complex XML, and a variable myNode which points to a specific node in the XML, is there any way to move it up or down underneath it’s parent?

I’ve tried all sorts of combinations…

The following is basically a “gotcha” for me:

<xml>
<parent>
<child>1</child>
</parent>
<parent>
<child>2</child>
<child>3</child>
</parent>
</xml>

When I try to grab parent() from any of the children, it returns null…

Anyway- help is appreciated. Thanks!