I am looking for an xpath expression that 1) matches all elements that have /images in the style attribute
Directly translated into XPath :
/*/element[contains(@style, '/images')]
.,.
...
and 2) matches all Image elements that have /images in src attribute
The XML document provided does not have Image elements. You probably meant: element elements with a class attribute with the value "Image" :
/*/element[@class='Image'][contains(@src, '/images')]
Combined with each other, the above XPath expressions give :
/*/element [contains(@style, '/images') or @class='Image' and contains(@src, '/images') ]
It seems to me that the most likely for the second requirement above you really want the src attribute value to actually start with "/images" . If so, a more accurate XPath expression:
/*/element [contains(@style, '/images') or @class='Image' and starts-with(@src, '/images') ]
source share