<?php
$xmlDoc = new DomDocument();
$xmlDoc -> load("books.xml");
$xpath = new DOMXpath($xmlDoc);
$elements = $xpath->evaluate("//dblpperson/r/**article**/author[@pid = '1234']" | "//dblpperson/r/**inproceedings**/author[@pid = '1234']" );
echo count($elements);
?>
This is giving an error. Please suggest the correct way to use AND operator.
Just use (you can remove the XPath count () function if you don't want it) :
count(//author[@pid="1234"][parent::article or parent::inproceedings])
Example with : https://dblp.org/pers/g/Gauthier:Fran=ccedil=ois.xml
count(//author[@pid="65/9612"][parent::article or parent::inproceedings])
Result : 21