'OR' operator in XPath predicate?

后端 未结 2 560
半阙折子戏
半阙折子戏 2020-12-30 21:39

What is the XPath expression to select elements with type=\"application/rss+xml\" OR type=\"application/atom+xm

2条回答
  •  伪装坚强ぢ
    2020-12-30 22:16

    use:

    link[@rel='alternate'][@type='application/rss+xml' or @type='application/atom+xml'] 
    

    see http://www.w3.org/TR/xpath/#NT-OrExpr

    You could also use union to accomplish this

    link[@rel='alternate'][@type='application/rss+xml']|link[@rel='alternate'][@type='application/atom+xml']
    

    but or will do.

提交回复
热议问题