code: protected void changeToVarRef(QName varName, ExpressionOwner owner, 
                                  Vector paths, ElemTemplateElement psuedoVarRecipient) 
    {
  	Variable varRef = (paths == m_absPaths) ? new VariableSafeAbsRef() : new Variable();
  	varRef.setQName(varName);
  	if(paths == m_absPaths)
  	{
  		StylesheetRoot root = (StylesheetRoot)psuedoVarRecipient;
  		Vector globalVars = root.getVariablesAndParamsComposed();
  		// Assume this operation is occuring just after the decl has 
  		// been added.
  		varRef.setIndex(globalVars.size()-1);
  		varRef.setIsGlobal(true);
  	}
  	owner.setExpression(varRef);
    }
docs: Change the expression owned by the owner argument to a variable reference
  of the given name.
  
  Warning: For global vars, this function relies on the variable declaration
  to which it refers having been added just prior to this function being called,
  so that the reference index can be determined from the size of the global variables
  list minus one.
  
  @param varName The name of the variable which will be referenced.
  @param owner The owner of the expression which will be replaced by a variable ref.
  @param paths The paths list that the iterator came from, mainly to determine
  if this is a local or global reduction.
  @param psuedoVarRecipient The element within whose scope the variable is
  being inserted, possibly a StylesheetRoot.