Re: [xsl] position() function problems on xalan

Subject: Re: [xsl] position() function problems on xalan
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 22 May 2002 16:56:16 +0100
number one rule to speed up stylesheets: don't use //

//call

causes a search of the entire document (in particular, inside every call
element to see if there are any descendent calls.

/telcoCallList/calls/call

is likely to be much better.

//call[(count(preceding::call

has n^2 performance as for each call you're going back over all the
preceding ones. You just want to select the n'th one out of teh current
list so:

(/telcoCallList/calls/call)[position() = $current_call]


> I get 3 call elements, the first from each calls sub-tree
That's what you are supposed to get, so it looks like they fixed a bug
you shouldn't rely on teh old behaviour. If you want the predicate to
count over the whole expression not just the final step you need () as above.

David

_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service. For further
information visit http://www.star.net.uk/stats.asp or alternatively call
Star Internet for details on the Virus Scanning Service.

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread