The copy command


copy expression

Deletes everything other than the nodes selected by the expression; returns a new document containing only the selected nodes. Note that if the expression selects multiple elements, the new document will not be a well-formed XML document (it will be a "fragment").

The result of the operation can be inspected using the command show.


The command:

copy //img

returns a document containing as its children copies of all the img elements in the source.