[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: xxRe: efficient use of key element and function

Subject: Re: xxRe: efficient use of key element and function
From: Manfred Staudinger <manfred.staudinger@xxxxxxxxx>
Date: Wed, 7 Sep 2005 18:09:27 +0200
xxre
In my real stylesheet I have 1500 names and
about the same number of uses for key(). The names represent files and
are used to avoid a file-not-found for doc(). They are retrieved by
means of collection() and
for each "not-found" a new file will be created.

I would like to thank you especially for your explanations
which helped me a lot!

Regards Manfred


On 9/7/05, David Carlisle <davidc@xxxxxxxxx> wrote:
>   <xsl:key name="find" match="name" use="text()"/>
>   Is this the best (most efficient) solution?
>
> If you only use the key a small fixed number of times, then it's
> probably not worth using a key at all (it may be, you'd need to do
> timings to check) the system has to traverse the entire tree to build
> the key table and take memory and time to build the table. If you are
> going to make lots of accesses to find different name elements (as in
> repeatedly for each of thousands of input elements) then building the
> key index is definitely worth it, but if it is just for a small number
> fixed in the stylesheet then probably not.
>
> especially in use such as
>
> <xsl:value-of select="empty(key('find', 'prunauer_regina', $Index-alt))"/>
>
>
> as here you are interested just if there is any such node, so you don't
> need to traverse the whole tree at all you can stop as soon as you find
> one, so I'd not use a key at all and just do
>
> select="empty(//name[.='prunauer_regina'])"
>
> but it depends whether your real case really is like this or whether
> it's just over simplified while generating a small example to post.
>
> David
>
> ________________________________________________________________________
> This e-mail has been scanned for all viruses by Star. The
> service is powered by MessageLabs. For more information on a proactive
> anti-virus service working around the clock, around the globe, visit:
> http://www.star.net.uk
> ________________________________________________________________________

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.