Re: [xslt] efficiency



On Thu, May 23, 2002 at 02:54:43AM -0400, Michael Rothwell wrote:
> Thanks. I'll check that out.
> 
> Well, I've figured out that doing this:
> 
> select="//page/@id"
> 
> ...in a loop is bad.

  // means the whole tree is scanned to find the associated nodes !!!

> Since I use that value in a lot of places, I did this at the top of the
> stylesheet file:
> 
> <xsl:variable name="pageid" select="//page/@id"/>
> 
> and refer to $pageid rather than //page/@id
> 
> ...  one order of magnitude faster.

  should also become linear w.r.t. the input tree size.

Daniel

-- 
Daniel Veillard      | Red Hat Network https://rhn.redhat.com/
veillard@redhat.com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]