clone_attributes function added

to address the problem of multiple element nodes
pointing to a shared attribute list