diff --git a/xpath.c b/xpath.c index d15fd8bb..30e9959a 100644 --- a/xpath.c +++ b/xpath.c @@ -8508,28 +8508,9 @@ xmlXPathCountFunction(xmlXPathParserContextPtr ctxt, int nargs) { if ((cur == NULL) || (cur->nodesetval == NULL)) valuePush(ctxt, xmlXPathCacheNewFloat(ctxt->context, (double) 0)); - else if ((cur->type == XPATH_NODESET) || (cur->type == XPATH_XSLT_TREE)) { + else valuePush(ctxt, xmlXPathCacheNewFloat(ctxt->context, (double) cur->nodesetval->nodeNr)); - } else { - if ((cur->nodesetval->nodeNr != 1) || - (cur->nodesetval->nodeTab == NULL)) { - valuePush(ctxt, xmlXPathCacheNewFloat(ctxt->context, (double) 0)); - } else { - xmlNodePtr tmp; - int i = 0; - - tmp = cur->nodesetval->nodeTab[0]; - if ((tmp != NULL) && (tmp->type != XML_NAMESPACE_DECL)) { - tmp = tmp->children; - while (tmp != NULL) { - tmp = tmp->next; - i++; - } - } - valuePush(ctxt, xmlXPathCacheNewFloat(ctxt->context, (double) i)); - } - } xmlXPathReleaseObject(ctxt->context, cur); }