1

我有这个 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' ] ]

有没有办法做到这一点?

4

1 回答 1

0

在 xpath2 你可以去

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

在纯 xpath1 中,您会受到更多限制,尽管如果您使用 xslt 或其他可以定义 xpath 变量的上下文,您可能会使其更整洁一些。

于 2012-03-24T23:41:59.000 回答