void visitAndTransform(TemplateElement[] elementBuffer,TemplateTransformModel transform,Map args) throws TemplateException, IOException {
  try {
    Writer tw=transform.getWriter(out,args);
    if (tw == null)     tw=EMPTY_BODY_WRITER;
    TransformControl tc=tw instanceof TransformControl ? (TransformControl)tw : null;
    Writer prevOut=out;
    out=tw;
    try {
      if (tc == null || tc.onStart() != TransformControl.SKIP_BODY) {
        do {
          visit(elementBuffer);
        }
 while (tc != null && tc.afterBody() == TransformControl.REPEAT_EVALUATION);
      }
    }
 catch (    Throwable t) {
      try {
        if (tc != null) {
          tc.onError(t);
        }
 else {
          throw t;
        }
      }
 catch (      TemplateException e) {
        throw e;
      }
catch (      IOException e) {
        throw e;
      }
catch (      RuntimeException e) {
        throw e;
      }
catch (      Error e) {
        throw e;
      }
catch (      Throwable e) {
        throw new UndeclaredThrowableException(e);
      }
    }
 finally {
      out=prevOut;
      tw.close();
    }
  }
 catch (  TemplateException te) {
    handleTemplateException(te);
  }
}

void visitAndTransform ( TemplateElement [ ] elementBuffer , TemplateTransformModel transform , Map args ) throws TemplateException , IOException { try { Writer tw = transform . getWriter ( out , args ) ; if ( tw == null ) tw = EMPTY_BODY_WRITER ; TransformControl tc = tw instanceof TransformControl ? ( TransformControl ) tw : null ; Writer prevOut = out ; out = tw ; try { if ( tc == null || tc . onStart ( ) != TransformControl . SKIP_BODY ) { do { visit ( elementBuffer ) ; } while ( tc != null && tc . afterBody ( ) == TransformControl . REPEAT_EVALUATION ) ; } } catch ( Throwable t ) { try { if ( tc != null ) { tc . onError ( t ) ; } else { throw t ; } } catch ( TemplateException e ) { throw e ; } catch ( IOException e ) { throw e ; } catch ( RuntimeException e ) { throw e ; } catch ( Error e ) { throw e ; } catch ( Throwable e ) { throw new UndeclaredThrowableException ( e ) ; } } finally { out = prevOut ; tw . close ( ) ; } } catch ( TemplateException te ) { handleTemplateException ( te ) ; } }
" visit " the template element , passing the output through a templatetransformmodel
