I have the following kind of HTML. The content is grouped by the <div "id=foo">
and <div "id=foo1">
elements, with <div "style=padding…">
in-between.
I'm trying to figure out how to craft an XPath expression that will allow me to trigger off the "id=foo"
to return the sibling <div>
s with "style=padding…"
Getting the <div id="foo">
is trivial. However, I can't just do a following-sibling
based on the "style=padding…"
because it then returns all the matching <div>
s.
I need a way to return the matching <div>
s until I hit the sibling that matches the "id=foo1"
. I'm pretty sure there's a simple approach that I'm missing!
<div id="foo">stuff...</div>
<div style="padding:2px; ">stuff...</div>
<div id="foo1">stuff...</div>
<div id="foo">stuff...</div>
<div style="padding:2px; ">stuff...</div>
<div style="padding:2px; ">stuff...</div>
<div style="padding:2px; ">stuff...</div>
<div id="foo1">stuff...</div>