I use keys a lot and I would like to know how reliably they transfer when the same document is is referenced by different variables.

For example, assume $temp is a temporary document and key() is called with $temp as its third argument.

If a new variable is declared with <xsl:variable name="doc" select="($temp,$fallback)[1]"/>, will the hash created for $temp be applied if key() is called with $doc as the third argument?

What about if a template or function is called with $temp as a parameter? Will the hash be used inside the called template if key() is called with the appropriate argument, or will it be recreated?

I'm assuming in both cases that the hash is built only once and passed along until $temp goes out of scope. At that point I would assume that the memory used for the hash is released. Is this accurate?

David Rudel
Senior Data Analyst
ExploreLearning.com