xmove xpath location xpath




Like xcopy, except that xmove removes the source nodes after a succesfull copy. Remember that the moved nodes are actually different nodes from the original ones (which may not be obvious when moving nodes within a single document into locations that do not require type conversion). So, after the move, the original nodes do not exist neither in the document itself nor any nodelist variable.

See xcopy for more details on how the copies of the moved nodes are created.

The following example demonstrates how xcopy can be used to get rid of HTML <font> elements while preserving their content. As an exercise, try to find out why simple foreach //font { xmove node() replace . } would not work here.

Example 35. Get rid of all <font> tags

while //font[1] {
  foreach //font[1] {
    xmove ./node() replace .;

See Also

xcopy, move, insert, xinsert