private Templates tryCache ( String url ) throws Exception { Templates x = ( Templates ) m_cache . get ( url ) ; if ( x == null ) { synchronized ( m_cache ) { if ( ! m_cache . containsKey ( url ) ) { TransformerFactory factory = TransformerFactory . newInstance ( ) ; if ( factory . getClass ( ) . getName ( ) . equals ( "net.sf.saxon.TransformerFactoryImpl" ) ) { factory . setAttribute ( FeatureKeys . VERSION_WARNING , Boolean . FALSE ) ; } StreamSource ss = new StreamSource ( getInputStream ( url ) ) ; ss . setSystemId ( url ) ; x = factory . newTemplates ( ss ) ; m_cache . put ( url , x ) ; } } } return x ; }
Maintain prepared stylesheets in memory for reuse