code: public void initDocument()
      throws TemplateInitException
      {
          /*
           *  send an empty InternalContextAdapter down into the AST to initialize it
           */
  
          InternalContextAdapterImpl ica = new InternalContextAdapterImpl(  new VelocityContext() );
  
          try
          {
              /*
               *  put the current template name on the stack
               */
  
              ica.pushCurrentTemplateName( name );
              ica.setCurrentResource( this );
  
              /*
               *  init the AST
               */
  
              ((SimpleNode)data).init( ica, rsvc);
  
              String property = scopeName+'.'+RuntimeConstants.PROVIDE_SCOPE_CONTROL;
              provideScope = rsvc.getBoolean(property, provideScope);
          }
          finally
          {
              /*
               *  in case something blows up...
               *  pull it off for completeness
               */
  
              ica.popCurrentTemplateName();
              ica.setCurrentResource( null );
          }
  
      }
docs: initializes the document.  init() is not longer
  dependant upon context, but we need to let the
  init() carry the template name down throught for VM
  namespace features
  @throws TemplateInitException When a problem occurs during the document initialization.