what does this xpath mean ? can someone decipher this ?
//h1[following-sibling::*[1][self::b]]
Select every h1
element (in the document of the context node) that is immediately followed by a b
element (with no other intervening element, though there may be intervening text).
Breaking it down:
//h1
Select every h1
element that is a descendant of the root node of the document that contains the context node;
[...]
filter out any of these h1
elements that don't meet the following criteria:
[following-sibling::*[1]...]
such that the first following sibling element passes this test:
[self::b]
self is a b
element. Literally, this last test means, "such that when I start from the context node and select the self (i.e. the context node) subject to the node test that filters out everything except elements named b
, the result is a non-empty node set."
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With