For the example HTML below, an XPath query that returns the siblings of the \"a\" elements with class=\'A\' that have class=\'B\' can be written as: //a[@class=\'A\']/foll
//a[@class=\'A\']/foll
try it this way:
//a[@class='B'][preceding-sibling::*[1][name()='a'][@class='A']]