Search code examples
xmlstringxpathtumblrgoogle-docs

Extrace image that contains a string in Xpath


I am making an RSS Reader in Google Docs and I'm having trouble selecting only images that contain the string "1280.jpg".

=importxml("http://philamuseum.tumblr.com/post/108652754644/this-shell-from-the-11th-century-which-was","//img[contains(text(), '1280')]")

If I use:

=importxml(http://philamuseum.tumblr.com/post/108652754644/this-shell-from-the-11th-century-which-was","//img/@src")

Then I obtain all images in the webpage. I just want to obtain the images that have "1280.jpg" in the filename.

Note Fyi, this is a Tumblr blog. On Tumblr pages, all images have the 1280.jpg or the 510.jpg extension.


Solution

  • You could use this xpath:

    "//img/@src[contains(., '1280.jpg')]"