code: public void setRoot(int context, Object environment)
    {
  
      m_context = context;
      
      XPathContext xctxt = (XPathContext)environment;
      m_execContext = xctxt;
      m_cdtm = xctxt.getDTM(context);
      
      m_currentContextNode = context; // only if top level?
      
      // Yech, shouldn't have to do this.  -sb
      if(null == m_prefixResolver)
      	m_prefixResolver = xctxt.getNamespaceContext();
          
      m_lastFetched = DTM.NULL;
      m_foundLast = false;
      m_pos = 0;
      m_length = -1;
  
      if (m_isTopLevel)
        this.m_stackFrame = xctxt.getVarStack().getStackFrame();
        
      // reset();
    }
docs: Initialize the context values for this expression
  after it is cloned.
  
  @param context The XPath runtime context for this
  transformation.