{"id":"xpath10-count","version":"1.0.0","description":"Count the nodes in an XPath 1.0 node-set from location paths, axes, predicates, namespaces and union.","supported_operations":["count xpath 1.0 node set","how many xml nodes match this xpath","xpath count function for a location path","size of an xpath union node set","number of nodes selected by xpath 1.0","count elements attributes or namespaces by xpath"],"unsupported_operations":["returning the selected nodes or their paths","calling count() inside the XPath expression","XPath 2.0 sequence cardinality and arithmetic"],"semantics":["Returns the XPath 1.0 count() of the same node-set xpath10-select would return. The result is {count} and nothing else.","Union duplicates are eliminated first, so //para | //para on two para elements counts 2.","//para[1] counts the first para child of each parent. /descendant::para[1] counts one node. / counts the root, which is always 1.","count(/r), arithmetic, variables and XPath 2.0 syntax are unsupported_input. The count is not computed by evaluating a count() call inside the expression.","A missing match counts 0. Limits and malformed XML or XPath fail with the same codes as xpath10-select, before a count is returned."],"limits":{"max_xml_bytes":4096,"max_expression_bytes":1024,"max_depth":32,"max_nodes":400,"max_steps":100000,"max_output_bytes":32768,"max_namespace_bindings":16,"max_namespace_uri_bytes":512,"max_name_chars":256,"max_union_operands":32,"max_xpath_depth":32},"pricing":{"status":"unpriced","charge_usd":null},"input_schema":{"type":"object","additionalProperties":false,"required":["xml","expression"],"properties":{"xml":{"type":"string","minLength":1,"maxLength":4096},"expression":{"type":"string","minLength":1,"maxLength":1024},"namespaces":{"type":"object","additionalProperties":{"type":"string","minLength":1,"maxLength":512},"maxProperties":16}}},"output_schema":{"type":"object","additionalProperties":false,"required":["count"],"properties":{"count":{"type":"integer","minimum":0,"maximum":400}}},"examples":[{"input":{"xml":"<doc><para>A</para><sec><para>B</para><para>C</para></sec></doc>","expression":"//para[1]"},"output":{"count":2}},{"input":{"xml":"<doc/>","expression":"/ | /doc"},"output":{"count":2}},{"input":{"xml":"<doc/>","expression":"/missing"},"output":{"count":0}}],"execute_url":"/v1/tools/xpath10-count/versions/1.0.0/execute"}