protected static Templates _getTemplates ( final URL stylesheet ) { Templates templates = _templatesCache . get ( stylesheet ) ; if ( templates == null ) { InputStream is = null ; try { is = stylesheet . openStream ( ) ; //throws IOException templates = TransformerFactory . newInstance ( ) . newTemplates ( new StreamSource ( is ) ) ; //throws TransformerConfigurationException } catch ( Exception ex ) { throw new XmlException ( ex ) ; } finally { try { if ( is != null ) { is . close ( ) ; } } catch ( IOException io_ex ) { // not a fatal error _LOG_ . warn ( io_ex . toString ( ) ) ; } } _templatesCache . put ( stylesheet , templates ) ; } return templates ; }
Returns a Templates object i . e . a compiled XSLT stylesheet of the specified URL . Once the stylesheet is loaded it is cached for the next time . That is firstly the cache is searched for the URL .