开发者

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

开发者 https://www.devze.com 2023-01-28 03:15 出处:网络
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:\'?You can use the

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:'?


You can use the starts-with() function:

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

精彩评论

暂无评论...
验证码 换一张
取 消