[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: efficiency with id()
> <xsl:copy-of select="id($id)"/> well id() will only work if the attribute is of type ID which it wasn't in your sample document. If it is then this is probably quickest It depends a bit on your processor, if it indexes all IDs on input then id() is going to be easily faster than anything else, if (as is possibly more likely) it only indexes IDs if you actually use id() then the first time you use it you have to pay the prices of indexing the document, but if you use it often enough that usually is a price worth paying. > Is key() quicker? key() would _work_ on your input document, as it doesn't require a DOCTYPE, other than that it is presumably identical in speed to id() as the main point of key is that it gives the ID functionality to documents without requiring IDs specified in a DTD. Both of these will make some kind of index/hash table of the document so that finding an element by id will be quick, but it has to walk the entire tree to index it and costs space to store the index. If you are only looking up one element you might be better off with //*[@id='foo'] as with any speed question this is _highly_ dependent on which processor you use (some versions of msxsl had an acknowledged bug that using keys was almost always slow for example) the real answer is just to try it and time it. David ________________________________________________________________________ This e-mail has been scanned for all viruses by Star Internet. 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 ________________________________________________________________________ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
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
|