ext/xslt_lib/extfunc.c in ruby-xslt-0.9.8 vs ext/xslt_lib/extfunc.c in ruby-xslt-0.9.9

- old
+ new

@@ -57,16 +57,21 @@ // this assumes all the nodes are elements, which is a bad idea for (i = 0; i < obj->nodesetval->nodeNr; i++) { node = obj->nodesetval->nodeTab[i]; if( node->type == XML_ELEMENT_NODE ) { + VALUE cREXML; + VALUE cDocument; + VALUE rDocument; + VALUE rElement; + xmlNodeDump(buff, doc, node, 0, 0); - VALUE cREXML = rb_const_get(rb_cObject, rb_intern("REXML")); - VALUE cDocument = rb_const_get(cREXML, rb_intern("Document")); - VALUE rDocument = rb_funcall(cDocument, rb_intern("new"), 1,rb_str_new2((char *)buff->content)); - VALUE rElement = rb_funcall(rDocument, rb_intern("root"), 0); + cREXML = rb_const_get(rb_cObject, rb_intern("REXML")); + cDocument = rb_const_get(cREXML, rb_intern("Document")); + rDocument = rb_funcall(cDocument, rb_intern("new"), 1,rb_str_new2((char *)buff->content)); + rElement = rb_funcall(rDocument, rb_intern("root"), 0); rb_ary_push(ret, rElement); // empty the buffer (xmlNodeDump appends rather than replaces) xmlBufferEmpty(buff); @@ -133,10 +138,10 @@ break; case T_NIL: ret = xmlXPathNewNodeSet(NULL); break; case T_ARRAY: { - int i,j; + long i,j; ret = xmlXPathNewNodeSet(NULL); for(i = RARRAY_LEN(val); i > 0; i--) { xmlXPathObjectPtr obj = value2xpathObj( rb_ary_shift( val ) ); if ((obj->nodesetval != NULL) && (obj->nodesetval->nodeNr != 0)) {