XSL-评估条件表达式是否为“快捷方式”? [英] XSL - Does evaluating conditional expressions "shortcut"?
本文介绍了XSL-评估条件表达式是否为“快捷方式”?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
给出一个XSL'If'语句:
Given an XSL 'If' statement:
<xsl:if test="a = 'some value' and b = 'another value'">
如果 a
不等于某些值
,是否仍在检查 b
的值? (好像第一个测试是 false
一样,和
的唯一结果是 false
。)这就是C#之类的语言-我想知道XSL是否也是如此。
If a
does not equal 'some value'
, is the value of b
still checked? (As if the first test is false
, the only outcome of the and
is false
.) This is what languages like C# do - I was wondering if the same goes in XSL. Does it depend on the engine/parser?
推荐答案
是的,它称为惰性评估或短路,并且xsl支持它。请参阅: http://www.w3.org/TR/xpath#booleans
Yes, it is called lazy-evaluation or short-circuiting, and xsl supports it. See: http://www.w3.org/TR/xpath#booleans
和表达式由
求值,求值每个操作数并将
的值转换为布尔值,就像通过调用一样
到布尔函数。如果两个值均为true,则结果为
true,否则为false
。 如果左操作数
的计算结果为false,则不评估右操作数
。
这篇关于XSL-评估条件表达式是否为“快捷方式”?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文