Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XPath - compound predicate + test if value does NOT start with something

Tags:

xml

xpath

xquery

I need help with some XPath. Say I am working on XHTML. How do I select all the a elements whose href attribute is NOT empty and does not begin with, say, 'mailto:'?

like image 233
StackOverflowNewbie Avatar asked Dec 04 '10 13:12

StackOverflowNewbie


1 Answers

You can use the starts-with() function:

//a[@href != '' and not(starts-with(@href, 'mailto:'))]
like image 125
Frédéric Hamidi Avatar answered Sep 23 '22 14:09

Frédéric Hamidi