The following XPath,
//a[b = 'value1' and b = 'value2']/@id
will select id
attributes of all a
elements with a child b
element having string value equal to value1
AND another child b
element having string value equal to value2
as requested.
contains function can do it.
$nodes = $xpath->query("//b[contains(., 'value1')] | //b[contains(., 'value2')]");
And then, to get the parent id
$parent_id = $nodes->item(0)->parentNode->getAttribute("id");
A demo (with HTML) here.