Xpath for choosing next sibling

后端 未结 2 1095
无人及你
无人及你 2020-12-15 05:25

I have piece of HTML like this:

name
value
name2
value2

I want to find all places where the

2条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-15 06:03

    I am not sure that I understand you but there is my solution. This XPath matches ALL

    which are not followed by
    directly. So There is test structure

    
      
    name
    name2
    value2
    name
    value
    name2

    There is the XPath

    //dt[ name( following-sibling::*[1] ) != 'dd' ]
    

    or

    //dt[  not( following-sibling::*[1]/self::dd ) ]
    

    they do same thing

提交回复
热议问题