Two conditions using OR in XPATH

假如想象 提交于 2019-11-27 09:01:21
CosminO

you can use or / and inside [....]

Example:

//*[contains('abc') or contains('def') or text()='abcdef']

More info about operators: http://www.w3schools.com/xpath/xpath_operators.asp

and and or are allowed inside the condition: [here]. Or you may also use multiple paths in one XPath expression using the pipe sign.

//PeopleList/Row[c1] | //PeopleList/Row[c2]

I don't think you need an "or" here. You just need to translate both operands to lower-case, rather than only translating one of them.

As noted by Michael Kay, no or is necessary.

Simply use:

PeopleList/Row
  [contains(translate(@LastName, 
                     'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 
                     'abcdefghijklmnopqrstuvwxyz'), '" 
+
           translate(txtSearch.value,
                     'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 
                     'abcdefghijklmnopqrstuvwxyz')'" 

+ "')]");
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!