xsl-list
[Top] [All Lists]

Re: [xsl] following-sibling is evil

2014-07-06 14:40:05

Michael Kay
Saxonica
mike(_at_)saxonica(_dot_)com
+44 (0118) 946 5893



On 6 Jul 2014, at 20:01, Dimitre Novatchev dnovatchev(_at_)gmail(_dot_)com 
<xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> 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
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--

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