/* * call-seq: * &(node_set) * * Set Intersection — Returns a new NodeSet containing nodes common to the two NodeSets. */ static VALUE intersection(VALUE self, VALUE rb_other) { nokogiriNodeSetTuple *tuple, *other; xmlNodeSetPtr intersection; if(!rb_obj_is_kind_of(rb_other, cNokogiriXmlNodeSet)) rb_raise(rb_eArgError, "node_set must be a Nokogiri::XML::NodeSet"); Data_Get_Struct(self, nokogiriNodeSetTuple, tuple); Data_Get_Struct(rb_other, nokogiriNodeSetTuple, other); intersection = xmlXPathIntersection(tuple->node_set, other->node_set); return Nokogiri_wrap_xml_node_set(intersection, rb_iv_get(self, "@document")); }