isolate_nodes function

Isolate nodes in a document