下面給出了XPath表達式所支持的所有操作符:
Operator操作符
Description注釋
Example實例
Return value返回值
| Computes two node-sets連接兩條語句
//book | //cd Returns a node-set with all book and cd elements返回所有book和cd的節點屬性
+ Addition加
6 + 4 10 - Subtraction減
6 - 4 2 * Multiplication乘
6 * 4 24 div Division除
8 div 4 2 = Equal等
price=9.80 true if price is 9.80false if price is 9.90
返回true或false
!= Not equal不等
price!=9.80 true if price is 9.90false if price is 9.80
返回true或false
< Less than小於
price<9.80 true if price is 9.00false if price is 9.80
返回true或false
<= Less than or equal to小於等於
price<=9.80 true if price is 9.00false if price is 9.90
返回true或false
> Greater than大於
price>9.80 true if price is 9.90false if price is 9.80
返回true或false
>= Greater than or equal to大於等於
price>=9.80 true if price is 9.90false if price is 9.70
返回true或false
or or price=9.80 or price=9.70 true if price is 9.80false if price is 9.50
邏輯連接,判斷兩個條件中的一個
and and price>9.00 and price<9.90 true if price is 9.80false if price is 8.50
邏輯連接,同時判斷兩個條件
mod Modulus (division remainder)求余
5 mod 2 1