}
private Transformer getTransformer( String resourceKey ) {
try {
TemplatesCache tc = generator.getTemplatesCache();
Templates templates = tc.getTemplates( resourceKey );
if (templates == null) {
InputStream is = getClass().getResourceAsStream( resourceKey );
templates = tc.getTemplates( resourceKey, new StreamSource( is, resourceKey ));
}
Transformer ret = templates.newTransformer();
ret.setURIResolver( generator.getResourceURIResolver()); // not auto copied from TrFactory
ret.setErrorListener( this );