之一,我有简单的XPath的XPath包含多个值
/products/product[contains(categorie,'Kinderwagens')]
它的工作原理,但现在我怎么在多个categorie过滤器值
像
/products/product[contains(categorie,'Kinderwagens')] +
/products/product[contains(categorie,'Kinderwagens')]
之一,我有简单的XPath的XPath包含多个值
/products/product[contains(categorie,'Kinderwagens')]
它的工作原理,但现在我怎么在多个categorie过滤器值
像
/products/product[contains(categorie,'Kinderwagens')] +
/products/product[contains(categorie,'Kinderwagens')]
将这项工作?
/products/product[contains(categorie,'Kinderwagens') or contains(categorie,'Wonderwagens')]
有一个类似的问题here
你真的想包含()?很多时候,人们使用contains()来测试节点是否包含值,当他们应该使用“=”时。不同之处在于,如果categorie元素的字符串值为'Kinderwagens',则categorie = 'wagens'
为false,但contains(categorie, 'wagens')
为true。
如果您实际上打算'=',那么在XPath 2.0中,您可以编写[categorie = ('Kinderwagens', 'Wonderwagens')]
。如果您仍在使用XPath 1.0,则需要使用'或'进行两次单独比较。
提交[新问题](https://stackoverflow.com/q/46503195/712334)与属性值一起使用。 –
问题是关于OR,不是吗? –
@imz编辑我的OR的答案,看看这是否有效。谢谢。 – Curious
注意自我。用5年多的XPath升级更新答案。 –