xslt - XSL - 评估条件表达式 "shortcut"吗?

标签 xslt conditional

给定 XSL 'If' 语句:

<xsl:if test="a = 'some value' and b = 'another value'">

a不等于 'some value' , 是 b 的值还在检查吗? (好像第一个测试是 falseand 的唯一结果是 false 。)这就是像 C# 这样的语言所做的 - 我想知道 XSL 中是否也是如此。它是否取决于引擎/解析器?

最佳答案

是的,它被称为延迟评估或短路,并且 xsl 支持它。见:http://www.w3.org/TR/xpath#booleans

An and expression is evaluated by evaluating each operand and converting its value to a boolean as if by a call to the boolean function. The result is true if both values are true and false otherwise. The right operand is not evaluated if the left operand evaluates to false.

关于xslt - XSL - 评估条件表达式 "shortcut"吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1410057/

相关文章:

r - 你如何在 R 中做条件 "left join"?

java - Java 中的三元表达式是如何求值的?

R:在 data.tables 列表中创建多个列并根据分组变量的条件修改它们

post - MSBuild 条件执行?

xml - xslt 中文化特定值的总和

javascript - 火狐浏览器 : execute javascript in xslt

xml - 用于搜索具有包含特定字符串的任何属性的节点的 Xpath?

excel - (Excel) 基于相邻单元格值的条件格式

xslt - 检查是否有节点但没有文本

java - 从 XSL 访问 Java 公共(public)静态