Attached is a patch against 3.2 which extends the functionality of the dom::node cloneNode sub-command.
New extended syntax is:
dom::node cloneNode token ?newDoc? ?-deep boolean? ?-attr boolean?
If newDoc is supplied, node will be cloned into this document - default is to clone into same document as original node. This is useful if you are creating a new document and want to include bits from other documents verbatim.
If attr option is set, attributes of the node are cloned in addition to the node itself.
patch file