[Home] [By Thread] [By Date] [Recent Entries]

Subject: RE: Do xsl processors contain optimizer for conditions?
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Sat, 14 Nov 2009 18:35:30 -0000
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@xxxxxxx] 
> Sent: 14 November 2009 17:14
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  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?

Current Thread
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member