/** * 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}. * * @return compiled XSLT stylesheet. */ public Templates getStylesheet(final String classPathUri) { return getStylesheet(classPathUri, false); }
/** * 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}. * * @return compiled XSLT stylesheet. */ public Templates getStylesheet(final String classPathUri) { return getStylesheet(classPathUri, false); }
public Document downConvertDOM(Document document) { /* If inlining CSS, create a document to hold the name/value pairs as described in * buildCSSPropertiesDocument(). Otherwise, we'll create an empty one to indicate * that nothing should be inlined */ Document cssPropertiesDocument = XMLUtilities.createNSAwareDocumentBuilder().newDocument(); if (cssProperties!=null) { buildCSSPropertiesDocument(cssPropertiesDocument, cssProperties); } /* Create URI Resolver to let the XSLT get at this document */ CSSPropertiesURIResolver uriResolver = new CSSPropertiesURIResolver(cssPropertiesDocument); /* Run the conversion XSLT */ Templates templates = stylesheetManager.getStylesheet(Globals.MATHML_TO_XHTML_XSL_RESOURCE_NAME); Document result = XMLUtilities.createNSAwareDocumentBuilder().newDocument(); try { Transformer transformer = templates.newTransformer(); transformer.setURIResolver(uriResolver); transformer.transform(new DOMSource(document), new DOMResult(result)); } catch (Exception e) { throw new SnuggleRuntimeException("Unexpected Exception down-converting DOM", e); } return result; }
public Document downConvertDOM(Document document) { /* If inlining CSS, create a document to hold the name/value pairs as described in * buildCSSPropertiesDocument(). Otherwise, we'll create an empty one to indicate * that nothing should be inlined */ Document cssPropertiesDocument = XMLUtilities.createNSAwareDocumentBuilder().newDocument(); if (cssProperties!=null) { buildCSSPropertiesDocument(cssPropertiesDocument, cssProperties); } /* Create URI Resolver to let the XSLT get at this document */ CSSPropertiesURIResolver uriResolver = new CSSPropertiesURIResolver(cssPropertiesDocument); /* Run the conversion XSLT */ Templates templates = stylesheetManager.getStylesheet(Globals.MATHML_TO_XHTML_XSL_RESOURCE_NAME); Document result = XMLUtilities.createNSAwareDocumentBuilder().newDocument(); try { Transformer transformer = templates.newTransformer(); transformer.setURIResolver(uriResolver); transformer.transform(new DOMSource(document), new DOMResult(result)); } catch (Exception e) { throw new SnuggleRuntimeException("Unexpected Exception down-converting DOM", e); } return result; }
serializer = getStylesheet(Globals.SERIALIZE_WITH_NAMED_ENTITIES_XSL_RESOURCE_NAME, true) .newTransformer(); if (serializerUri!=null) { serializer = getStylesheet(serializerUri) .newTransformer();
serializer = getStylesheet(Globals.SERIALIZE_WITH_NAMED_ENTITIES_XSL_RESOURCE_NAME, true) .newTransformer(); if (serializerUri!=null) { serializer = getStylesheet(serializerUri) .newTransformer();