    /*
     *  call-seq:
     *    delete(node)
     *
     *  Delete +node+ from the Nodeset, if it is a member. Returns the deleted node
     *  if found, otherwise returns nil.
     */
    static VALUE delete(VALUE self, VALUE rb_node)
    {
      xmlNodeSetPtr node_set ;
      xmlNodePtr node ;

      if(!(rb_obj_is_kind_of(rb_node, cNokogiriXmlNode) || rb_obj_is_kind_of(rb_node, cNokogiriXmlNamespace)))
        rb_raise(rb_eArgError, "node must be a Nokogiri::XML::Node or Nokogiri::XML::Namespace");

      Data_Get_Struct(self, xmlNodeSet, node_set);
      Data_Get_Struct(rb_node, xmlNode, node);

      if (xmlXPathNodeSetContains(node_set, node)) {
        xmlXPathNodeSetDel(node_set, node);
        return rb_node ;
      }

      return Qnil ;
    }