XSLT performance question regarding XPATH V2 key() feature

D

David Blickstein

In my XML Schema I'm dealing with, I can assume that key(x,y) and key(x,y,z)
always returns the same result set. That is, y is unique in key x
throughout the entire
document.

Does anyone know offhand if the performance of one form is likely to be
better than the other?

I would intuit that the 3-parameter form of key might actually be LESS
efficient in that the constraint can't be used in the key lookup but is an
additional filtering process that has to be done.

Unfortunately, I can't use IDs because I can't be guaranteed its declared in
a DTD.
 
D

Dimitre Novatchev

Do not expect any (noticeable) difference between the two overloads of the
key() function.

The two-argument one is simply a shorthand for:

key(<kName>, <kExpr>, .)

How and when the index corresponding to an xsl:key and used by a key()
function application -- this is implementation dependent, however most
implementations build an index "on-demand" -- the first time it is needed
for a particular document by a key() function.

Therefore, both overloads will not differ in this respect.


Cheers,
Dimitre Novatchev
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top