有多种类型的条件可用于对 XPath 表达式求值。
尽管对表达式求值的最常用运算符是 = (等号),但是您也可以使用任何有效的 XPath 运算符。请参阅基本 XPath 表达式,以获取有效 XPath 运算符的列表。
以下示例演示了如何使用多种条件对 XPath 表达式求值。
字符串字面值必须用引号引起,如下例所示:
bpws:getVariableData('PatientInfo')/PV1/Department = 'ICU'使用 bpws:getVariableData 函数访问变量数据
在 getVariableData 函数内使用字符串字面值:
下列示例对来自两个变量的字符串节点进行求值。 bpws:getVariableData 函数中的变量名称是字符串字面值。
bpws:getVariableData('PatientInfo')/PV1/Department = bpws:getVariableData('Orders')/PID/PtDept在 getVariableData 函数中使用数字文字:
要对数字文字求值,您必须对表达式的一侧或两侧进行强制类型转换。例如:
number(bpws:getVariableData('PatientInfo')/PV1/Department) = bpws:getVariableData('Orders')/PID/PtDept
- 或 -
number(bpws:getVariableData('PatientInfo')/PV1/Department) = number(bpws:getVariableData('Orders')/PID/PtDept)
数字文字不需要引号。在数字文字两侧放置引号会将其转换为字符串字面值。
有效的数字表达式示例:
bpws:getVariableData('PurchaseOrder')/PurchaseOrder/POTotal >= 5000.00
无效的数字表达式示例:
bpws:getVariableData('PurchaseOrder')/PurchaseOrder/POTotal >= '5000.00'