xsl-list
[Top] [All Lists]

RE: [xsl] Do xsl processors contain optimizer for conditions?

2009-11-14 13:36:01

XPath 1.0 mandates that the rhs of "and" isn't evaluated if the lhs is true
(and similarly for "or").

XPath 2.0 gives more discretion to the implementation, for example if you
write a predicate

customer[location='uk' and vatNumber='01234567']

and there is an index on vatNumber, then the processor is allowed to use it.

Regards,

Michael Kay
http://www.saxonica.com/
http://twitter.com/michaelhkay 



-----Original Message-----
From: cert21 [mailto:cert21(_at_)ptd(_dot_)net] 
Sent: 14 November 2009 17:14
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Do xsl processors contain optimizer for conditions?

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?



--~------------------------------------------------------------------
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>
--~--



--~------------------------------------------------------------------
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>
--~--

<Prev in Thread] Current Thread [Next in Thread>