在XPATH中使用OR的两个条件

编程入门 行业动态 更新时间:2024-10-25 18:26:05
本文介绍了在XPATH中使用OR的两个条件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个文本框'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的两个条件

本文发布于:2023-10-30 12:05:45,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1542797.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:条件   两个   XPATH

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!