Is the following possible in one XPath expression (see sample below):
Select all (span tags of class msg) AND all ((img tags that have a non-empty alt attribute) AND (are NOT located inside a span tag of class msg))
Simplified sample:
<span class="msg">Message text A</span>
<img alt="" />
<span class="msg">Message text B <img alt="text A" /></span>
<span class="err">Error text C <img alt="text B" /></span>
<img alt="text C" />
<span class="err">Error text D</span>
The resulting node set should contain:
<span class="msg">Message text A</span>
<span class="msg">Message text B <img alt="text A" /></span>
<img alt="text B" />
<img alt="text C" />