/*
 * call-seq:
 *  dup
 *
 * Duplicate this node set
 */
static VALUE dup(VALUE self)
{
  xmlNodeSetPtr node_set;
  Data_Get_Struct(self, xmlNodeSet, node_set);

  xmlNodeSetPtr dupl = xmlXPathNodeSetCreate(NULL);
  int i;
  for(i = 0; i < node_set->nodeNr; i++) {
    xmlXPathNodeSetAdd(dupl, node_set->nodeTab[i]);
  }

  return Nokogiri_wrap_xml_node_set(dupl);
}