It seems that PHP SimpleXML XPath doesn't allow to get results of XPath functions:
$s = new \SimpleXMLElement('<test><node>A</node><node>B</node></test>');
var_dump($s->xpath("count(node)"));
Returns an empty array:
array(0) {
}
While Using DOM returns the expected value 2:
$dom = new \DOMDocument();
$dom->loadXML('<test><node>A</node><node>B</node></test>');
$xpath = new \DOMXPath($dom);
var_dump($xpath->evaluate("count(node)"));
float(2.0)
Is there a way to do the same directly with SimpleXML?