MCPcopy Create free account
hub / github.com/Kitware/VTK / xmlXPathCountFunction

Function xmlXPathCountFunction

ThirdParty/libxml2/vtklibxml2/xpath.c:7467–7484  ·  view source on GitHub ↗

* xmlXPathCountFunction: * @ctxt: the XPath Parser context * @nargs: the number of arguments * * Implement the count() XPath function * number count(node-set) */

Source from the content-addressed store, hash-verified

7465 * number count(node-set)
7466 */
7467void
7468xmlXPathCountFunction(xmlXPathParserContextPtr ctxt, int nargs) {
7469 xmlXPathObjectPtr cur;
7470
7471 CHECK_ARITY(1);
7472 if ((ctxt->value == NULL) ||
7473 ((ctxt->value->type != XPATH_NODESET) &&
7474 (ctxt->value->type != XPATH_XSLT_TREE)))
7475 XP_ERROR(XPATH_INVALID_TYPE);
7476 cur = valuePop(ctxt);
7477
7478 if ((cur == NULL) || (cur->nodesetval == NULL))
7479 valuePush(ctxt, xmlXPathCacheNewFloat(ctxt, 0.0));
7480 else
7481 valuePush(ctxt, xmlXPathCacheNewFloat(ctxt,
7482 (double) cur->nodesetval->nodeNr));
7483 xmlXPathReleaseObject(ctxt->context, cur);
7484}
7485
7486/**
7487 * xmlXPathGetElementsByIds:

Callers

nothing calls this directly

Calls 4

valuePopFunction · 0.85
valuePushFunction · 0.85
xmlXPathCacheNewFloatFunction · 0.85
xmlXPathReleaseObjectFunction · 0.85

Tested by

no test coverage detected