I forwarded your question to the xproc-dev mailinglist. Apparently, the recommendation seems to contradict itself. Section 5.7 ( http://www.w3.org/TR/xproc/#variables-options-parameters ) says quite explicitly that shadowing should be allowed in specific conditions. But section 3.2 ( http://www.w3.org/TR/xproc/#scoping ) says that reusing the same variable name in a scope is an error. The consensus was though that this should in principle work:
<p:variable name="myvar" select="1"/>
<p:group>
<p:variable name="myvar" select="2"/>
However, XMLCalabash (0.9.40) chokes on this. You might try Calumet or other processors though..