[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
<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 ________________________________________________________________________
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|