Re: [xsl] xslt performance issue position() function used in predicate very slow

Subject: Re: [xsl] xslt performance issue position() function used in predicate very slow
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 25 Aug 2006 12:25:50 +0100
performance questions are always processor specific, and you haven't
said what processor you are using.

<xsl:value-of select="./v[position()=$p]"/>
(the ./ at the front isn't needed)

> BTW abbreviated version doesn't wok  i.e. select="./v[$p]" but
> select="./v[$p+0]" works
> is this some bug ???

most likely you are defining $p to be a string or result tree fragment
rather than a number, in which case v[$p] is the same as v[true()]
ie the same as v, unless $p is the empty string.
It's likely to be more efficient to generate $p as a number than a result
tree fragment, if that's what you are doing.

David

Current Thread