In a key element, it is an error for the value of either the use attribute or the match attribute to contain a variable reference.
But can the use attribute or the match attribute contain a key() function?
This seems allowed, but it would only make sense if key elements are executed in document order in the stylesheet. Is that guaranteed?
(If this does indeed work, then one could sometimes use a key() function within a use or match to do the job that a disallowed global variable would do.)
In XSLT 1.0 both of these are errors.
From the W3C Errata to the XSLT 1.0 Specification:
In XSLT 2.0 the use of the
key()function in these places is allowed, provided that a key is not defined in terms of itself (no circular references in definitions are allowed).