ruby - XPath to select between two HTML comments is not working?

Solution:
If you are interested in the first pair of comments, you could start with looking for the first comment:
//comment()[.=' begin content ']/following::*[not(preceding::comment()[.=' end content '])]
I.e.:
//comment()[1][.=' begin content '] <-- look for first suitable comment
/following::* <-- take all following nodes
[not(preceding::comment()[.=' end content '])] <-- satisfying condition there is no preceding "end comment"
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: failed to create image decoder with message 'unimplemented'
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.