Excellent question, well asked.
The behavior you expect would be natural in a language with dynamic scope. But XSLT uses lexical scope for variables, not dynamic scope.
You ask Now, what does "context" actually mean in XSLT, or more precisely, is a parameter considered part of the context or not?
Short answer: Yes, the parameter is part of the static context, for the expressions in its scope (and its absence is a fact about the static context of expressions elsewhere in the stylesheet); its value is part of the dynamic context for expressions in its scope. And (crucially) the xsl:call-template
instruction does affect the context in which expressions are evaluated.
Longer answer: The specifics are to be found in the XSLT 2.0 spec. In section 2.5 the spec tells us that the context is divided into two parts: the static context and the dynamic context. Section 5.4 provides full details; section 5.4.1 lists "in-scope variables" as one component of the static context.
The scope rules for variables are given in section 9.7. The key bit is this:
A local variable binding element is visible for all following siblings and their descendants, with two exceptions: it is not visible in any region where it is shadowed by another variable binding, and it is not visible within the subtree rooted at an xsl:fallback instruction that is a sibling of the variable binding element.
The apparent contradiction you have run into relies crucially on the premise that "calling a template does not affect the context". This premise is not in fact correct, despite the fact that you have it on very good authority.
In section 10.1, the spec says that "the xsl:call-template
instruction does not change the focus." It does not say that the instruction leave the context unaffected.
In the passage you quote from Michael Kay's book, I believe the term "context" is perhaps best taken as short for "context item", or perhaps "dynamic context". Even on that reading the sentence is not quite correct: because the dynamic variables
component of the context differs, the dynamic context in the called template is not exactly the same as in the calling template. I think you have to cut MK some slack here: the paragraph in question is essentially unchanged from the XSLT 1.0 version of his book, and in XSLT 1.0 there is no explicit representation, in the discussion of context, of the dynamic binding of variables and parameters to names. But I think it's fair to say you've found something in the book MK might wish to change in the next revision.