I am reformatting an HTML document using the Agility Pack, and I've run into a limitation of my understanding of XPath.
In the document I'm working with, the following is a common construct:
Which is built like this:
128<img src="" style="display: none;" alt="^(" /><sup>2</sup><img src="" style="display: none;" alt=")" />
So, when you select that and copy it to the clipboard it turns into:
Now, I would like to use XPath to remove these
Here is what I have so far:
How do I select an element based on existence of an immediate sibling?
apparently it is something like this:
//img[@alt='^(' and following-sibling::*[self::sup]]
That is (and, I'm guessing, here):
[@alt='^(' and ... ]
alt attribute is
'^(' and ...
... whose first following sibling ...
... can call itself a
Off the top of my head, make it a compound condition. Something like:
//img[@alt='^(' ???/sup AND preceding-sibling::* AND following-sibling::*]