XPath is a complex predicate + test if the value does NOT start with something

I need help with some XPath. Say I'm working on XHTML. How to select all elements awhose attribute is hrefNOT empty and does not start with, say, 'mailto:'?

+5
source share
1 answer

You can use the start-with () function :

//a[@href != '' and not(starts-with(@href, 'mailto:'))]
+4
source

All Articles