XPath to get node that with text contains quotes



I'm trying to get all nodes that contain particular text. I also want to ignore case and be able to search for text contains single and double quotes. I'm using Python and lxml (XPath 1.0)


this doesn't work:


page_tree.xpath(u"""//*[contains(translate(., "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "abcdefghijklmnopqrstuvwxyz"), "concat('test ',"'",'test',"'",' ','"','test','"')")]"""


or maybe I should just iterate over every element in site tree and manually check if it contains searched phrase?


No comments:

Post a Comment