* @param isGlobal true if this will be a global reference.
*/
protected LocPathIterator changePartToRef(final QName uniquePseudoVarName, WalkingIterator wi,
final int numSteps, final boolean isGlobal)
{
Variable var = new Variable();
var.setQName(uniquePseudoVarName);
var.setIsGlobal(isGlobal);
if(isGlobal)
{ ElemTemplateElement elem = getElemFromExpression(wi);
StylesheetRoot root = elem.getStylesheetRoot();
Vector vars = root.getVariablesAndParamsComposed();
var.setIndex(vars.size()-1);
}
// Walk to the first walker after the one's we are replacing.
AxesWalker walker = wi.getFirstWalker();
for(int i = 0; i < numSteps; i++)