我有一个文本框'txtSearch'。我用它来按姓氏搜索人。这是我的代码。
I have a textbox, 'txtSearch'. I am using it to search people by Last Name. this is my code.
var xmlTempResultSearch = xmlResidentListDisplay.selectNodes( "//PeopleList/Row[contains(translate(@LastName, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'), '" + txtSearch.value + "')]");此代码选择XML中的所有姓氏,如txtSearch文本框中的文本输入。
This code selects all last names in the XML like the text input in the txtSearch textbox.
这会将所有大写字母转换为小写字母。
This translates all uppercase letters to lowercase letters.
因此,如果我正在搜索'Dorosan',如果我输入'doro',它会检索到正确的人,因为它将'D'翻译为'd'。但是当我输入'Doro'时,它并没有找到正确的人。
So if I am searching for 'Dorosan', if I type 'doro', it retrieves the correct person because it translated the 'D' to 'd'. But when I type 'Doro', it doesn't retrieve the correct person.
我想知道我是否可以在XPATH中有两个条件,以及如何?我希望能够将所有大写翻译为小写,或者将所有小写翻译为大写。
I'm wondering if I can have two conditions in an XPATH, and how? I want to be able to translate all uppercase to lowercase, OR translate all lowercase to uppercase.
推荐答案您可以使用或 / 和内 [....]
示例:
//*[contains('abc') or contains('def') or text()='abcdef']更多有关运营商的信息: www.w3schools/xpath/xpath_operators.asp
More info about operators: www.w3schools/xpath/xpath_operators.asp
更多推荐
在XPATH中使用OR的两个条件
发布评论