getLogger().debug("Creating new Templates for " + id);
}
// Create a Templates ContentHandler to handle parsing of the
// stylesheet.
TemplatesHandler templatesHandler = this.factory.newTemplatesHandler();
// Set the system ID for the template handler since some
// TrAX implementations (XSLTC) rely on this in order to obtain
// a meaningful identifier for the Templates instances.
templatesHandler.setSystemId(id);
if (filter != null) {
filter.setContentHandler(templatesHandler);
}
if (this.getLogger().isDebugEnabled()) {
getLogger().debug("Source = " + stylesheet
+ ", templatesHandler = " + templatesHandler);
}
// Process the stylesheet.
stylesheet.toSAX(filter != null ?
(ContentHandler)filter : (ContentHandler)templatesHandler);
// Get the Templates object (generated during the parsing of
// the stylesheet) from the TemplatesHandler.
templates = templatesHandler.getTemplates();
putTemplates (templates, stylesheet, id);
} else {
if (this.getLogger().isDebugEnabled()) {
getLogger().debug("Reusing Templates for " + id);
}