/** * Obtains the XSLT stylesheet at the given ClassPathURI, using the {@link StylesheetCache} * (if set) to cache stylesheets for efficiency. * * @param classPathUri location of the XSLT stylesheet in the ClassPath, following the * URI scheme in {@link ClassPathURIResolver}. * @param requireXSLT20 if false uses the JAXP default {@link TransformerFactory}, otherwise * specifies that we require an XSLT 2.0-compliant transformer, of which the only currently * supported implementation is SAXON 9.x. * * @return compiled XSLT stylesheet. */ public Templates getStylesheet(final String classPathUri, final boolean requireXSLT20) { Templates result; if (stylesheetCache==null) { result = compileInternalStylesheet(classPathUri, requireXSLT20); } else { synchronized(stylesheetCache) { result = stylesheetCache.getStylesheet(classPathUri); if (result==null) { result = compileInternalStylesheet(classPathUri, requireXSLT20); stylesheetCache.putStylesheet(classPathUri, result); } } } return result; }
/** * Obtains the XSLT stylesheet at the given ClassPathURI, using the {@link StylesheetCache} * (if set) to cache stylesheets for efficiency. * * @param classPathUri location of the XSLT stylesheet in the ClassPath, following the * URI scheme in {@link ClassPathURIResolver}. * @param requireXSLT20 if false uses the JAXP default {@link TransformerFactory}, otherwise * specifies that we require an XSLT 2.0-compliant transformer, of which the only currently * supported implementation is SAXON 9.x. * * @return compiled XSLT stylesheet. */ public Templates getCompiledStylesheet(final String classPathUri, final boolean requireXSLT20) { Templates result; if (stylesheetCache==null) { result = compileStylesheet(classPathUri, requireXSLT20); } else { synchronized(stylesheetCache) { result = stylesheetCache.getStylesheet(classPathUri); if (result==null) { result = compileStylesheet(classPathUri, requireXSLT20); stylesheetCache.putStylesheet(classPathUri, result); } } } return result; }
/** * Obtains the XSLT stylesheet at the given ClassPathURI, using the {@link StylesheetCache} * (if set) to cache stylesheets for efficiency. * * @param classPathUri location of the XSLT stylesheet in the ClassPath, following the * URI scheme in {@link ClassPathURIResolver}. * @param requireXSLT20 if false uses the JAXP default {@link TransformerFactory}, otherwise * specifies that we require an XSLT 2.0-compliant transformer, of which the only currently * supported implementation is SAXON 9.x. * * @return compiled XSLT stylesheet. */ public Templates getStylesheet(final String classPathUri, final boolean requireXSLT20) { Templates result; if (stylesheetCache==null) { result = compileInternalStylesheet(classPathUri, requireXSLT20); } else { synchronized(stylesheetCache) { result = stylesheetCache.getStylesheet(classPathUri); if (result==null) { result = compileInternalStylesheet(classPathUri, requireXSLT20); stylesheetCache.putStylesheet(classPathUri, result); } } } return result; }
private Templates cacheImporterStylesheet(final boolean requireXSLT20, final String... importUris) { Templates result; TransformerFactory transformerFactory = getTransformerFactory(requireXSLT20); if (stylesheetCache==null) { result = compileImporterStylesheet(transformerFactory, requireXSLT20, importUris); } else { String cacheKey = "snuggletex-importer(" + StringUtilities.join(importUris, ",") + ")"; synchronized(stylesheetCache) { result = stylesheetCache.getStylesheet(cacheKey); if (result==null) { result = compileImporterStylesheet(transformerFactory, requireXSLT20, importUris); stylesheetCache.putStylesheet(cacheKey, result); } } } return result; }
private Templates cacheImporterStylesheet(final boolean requireXSLT20, final String... importUris) { Templates result; TransformerFactory transformerFactory = getTransformerFactory(requireXSLT20); if (stylesheetCache==null) { result = compileImporterStylesheet(transformerFactory, requireXSLT20, importUris); } else { String cacheKey = "snuggletex-importer(" + StringUtilities.join(importUris, ",") + ")"; synchronized(stylesheetCache) { result = stylesheetCache.getStylesheet(cacheKey); if (result==null) { result = compileImporterStylesheet(transformerFactory, requireXSLT20, importUris); stylesheetCache.putStylesheet(cacheKey, result); } } } return result; }
/** * Obtains a "driver" XSLT stylesheet that imports the stylesheets having the given * ClassPath URIs, using the {@link StylesheetCache} (if set) to cache the resulting driver for efficiency. * * @param importClassPathUris List of locations of the XSLT stylesheets to be compiled, following the * URI scheme in {@link ClassPathURIResolver}. * @param requireXSLT20 if false uses the JAXP default {@link TransformerFactory}, otherwise * specifies that we require an XSLT 2.0-compliant transformer, of which the only currently * supported implementation is SAXON 9.x. * * @return compiled XSLT stylesheet. */ public Templates getCompiledStylesheetDriver(final List<String> importClassPathUris, final boolean requireXSLT20) { Templates result; if (stylesheetCache==null) { result = compileStylesheetDriver(importClassPathUris, requireXSLT20); } else { String cacheKey = "xslt-driver(" + StringUtilities.join(importClassPathUris, ",") + ")"; synchronized(stylesheetCache) { result = stylesheetCache.getStylesheet(cacheKey); if (result==null) { result = compileStylesheetDriver(importClassPathUris, requireXSLT20); stylesheetCache.putStylesheet(cacheKey, result); } } } return result; }