[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] following-sibling is evil


Subject: Re: [xsl] following-sibling is evil
From: "Michael Kay mike@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 6 Jul 2014 19:39:54 -0000

Michael Kay
Saxonica
mike@xxxxxxxxxxxx
+44 (0118) 946 5893



On 6 Jul 2014, at 20:01, Dimitre Novatchev dnovatchev@xxxxxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:

>> <xsl:if test="following-sibling::Book[Title eq $currentAuthor][Genre eq
$currentGenre][1]">
>
> Why not the obviously more-efficient -- especially for a naive
> processor that you describe -- code:
>
>    following-sibling::Book[Title eq $currentAuthor and Genre eq
> $currentGenre][1]

I can't see why that's obviously more efficient. They look identical to me.
>
> or probably even better (as a hint to the optimizer):
>
>    exists(head(following-sibling::Book[Title eq $currentAuthor and
> Genre eq $currentGenre]))

Again, it's still quadratic performance if your evaluate this for every Book.
>

Michael Kay
Saxonica


Current Thread