2012-03-24 33 views
1

一個說法我有這樣的XPath:的XPath比較多條語句

//a[ substring-after(substring-before(@href , '.deviantart.com') , 'http://') != 'about' and substring-after(substring-before(@href , '.deviantart.com') , 'http://') != 'browse' and substring-after(substring-before(@href , '.deviantart.com') , 'http://') != 'chat' ] 

,我希望能夠做這樣的事情:

//a[ substring-after(substring-before(@href , '.deviantart.com') , 'http://') != [ 'about' , 'browse' , 'chat' ] ] 

有沒有辦法做到這一點?

回答

0

在xpath2你可以去

//a[not(substring-after(substring-before(@href , '.deviantart.com') , 'http://') 
    = ('about' , 'browse' , 'chat')) ] 

純xpath1你是相當多的限制,但如果你正在使用XSLT或其他一些情況下,你可以定義的XPath變量,你也許可以使它有點整潔。

+0

我使用它在JavaScript中的document.evaluate函數,它不起作用 – 2012-03-25 02:18:27