cert21 wrote:
I know in many languages like Java and php when testing for multiple
conditions
the engine is smart to return false when the first condition fails, so
it does not even check
next conditions.
This saves some of the processing time.
I wonder if xsl engines follow the same logic, for example in test like
this:
<xsl:when
test="( (string-length($mystring) > 30) and
not(contains(substring($mystring, 1, 30), ' ') ) )">
If the string-length is < 30 then the second condition will not even be
evaluated?
Technically it is a question about XPath expressions, if you look at the
specification http://www.w3.org/TR/xpath#booleans then it clearly says
for 'and' expressions:
"The right operand is not evaluated if the left operand evaluates to
false."
And for 'or' expressions:
"The right operand is not evaluated if the left operand evaluates to
true."
So it is not question about optimization, the language specification
prescribes what to do.
--
Martin Honnen
http://msmvps.com/blogs/martin_honnen/
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--