XPath axis, get all following nodes until

后端 未结 7 1341
醉话见心
醉话见心 2020-12-01 11:18

I have the following example of HTML:


Foo bar

lorem

ipsum

etc

7条回答
  •  独厮守ぢ
    2020-12-01 11:37

    This XPATH 1.0 statement selects all of the

    that are siblings that follow an

    who's string value is equal to "Foo bar", that are also followed by an

    sibling element who's first preceding sibling

    has a string value of "Foo bar".

    //p[preceding-sibling::h2[.='Foo bar']]
     [following-sibling::h2[
      preceding-sibling::h2[1][.='Foo bar']]]
    

提交回复
热议问题