XPath: how to select following siblings until a certain sibling

后端 未结 3 1841
梦如初夏
梦如初夏 2021-02-18 22:20

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

3条回答
  •  耶瑟儿~
    2021-02-18 22:56

    try it this way:

    //a[@class='B'][preceding-sibling::*[1][name()='a'][@class='A']]
    

提交回复
热议问题