/** * Process the Source into a Transformer object. Care must * be given not to use this object in multiple threads running concurrently. * Different TransformerFactories can be used concurrently by different * threads. * * @param source An object that holds a URI, input stream, etc. * * @return A Transformer object that may be used to perform a transformation * in a single thread, never null. * * @exception TransformerConfigurationException May throw this during the parse * when it is constructing the Templates object and fails. */ public Transformer newTransformer(Source source) throws TransformerConfigurationException { Templates templates = newTemplates(source); return templates.newTransformer(); }
/** * Process the Source into a Transformer object. Care must * be given not to use this object in multiple threads running concurrently. * Different TransformerFactories can be used concurrently by different * threads. * * @param source An object that holds a URI, input stream, etc. * * @return A Transformer object that may be used to perform a transformation * in a single thread, never null. * * @exception TransformerConfigurationException May throw this during the parse * when it is constructing the Templates object and fails. */ public Transformer newTransformer(Source source) throws TransformerConfigurationException { Templates templates = newTemplates(source); return templates.newTransformer(); }
/** * Get a TransformerHandler object that can process SAX * ContentHandler events into a Result, based on the transformation * instructions specified by the argument. * * @param src The Source of the transformation instructions. * * @return TransformerHandler ready to transform SAX events. * * @throws TransformerConfigurationException If for some reason the * TransformerHandler can not be created. */ public TransformerHandler newTransformerHandler(Source src) throws TransformerConfigurationException { Templates tmpl = newTemplates(src); return newTransformerHandler(tmpl); }
/** * Create an XMLFilter that uses the given Source as the * transformation instructions. * * @param src The Source of the transformation instructions. * * @return An XMLFilter object, or null if this feature is not supported. * * @throws TransformerConfigurationException If for some reason the * XMLFilter cannot be created. */ public XMLFilter newXMLFilter(Source src) throws TransformerConfigurationException { Templates tmpl = newTemplates(src); return newXMLFilter(tmpl); }
/** * Create an XMLFilter that uses the given Source as the * transformation instructions. * * @param src The Source of the transformation instructions. * * @return An XMLFilter object, or null if this feature is not supported. * * @throws TransformerConfigurationException If for some reason the * XMLFilter cannot be created. */ public XMLFilter newXMLFilter(Source src) throws TransformerConfigurationException { Templates tmpl = newTemplates(src); return newXMLFilter(tmpl); }
/** * Get a TransformerHandler object that can process SAX * ContentHandler events into a Result, based on the transformation * instructions specified by the argument. * * @param src The Source of the transformation instructions. * * @return TransformerHandler ready to transform SAX events. * * @throws TransformerConfigurationException If for some reason the * TransformerHandler can not be created. */ public TransformerHandler newTransformerHandler(Source src) throws TransformerConfigurationException { Templates tmpl = newTemplates(src); return newTransformerHandler(tmpl); }
/** * Compile a document containing a stylesheet module into a stylesheet that can be used to perform * transformations * * @param context the XPath dynamic evaluation context * @param doc the document containing the stylesheet to be compiled * @return the compiled stylesheet */ public static Templates compileStylesheet(XPathContext context, DocumentInfo doc) throws XPathException { if (doc == null) { return null; } try { TransformerFactoryImpl factory = new TransformerFactoryImpl(context.getConfiguration()); return factory.newTemplates(doc); } catch (TransformerConfigurationException e) { throw XPathException.makeXPathException(e); } }
/** * Compile a document containing a stylesheet module into a stylesheet that can be used to perform * transformations * * @param context the XPath dynamic evaluation context * @param doc the document containing the stylesheet to be compiled * @return the compiled stylesheet */ public static Templates compileStylesheet(XPathContext context, DocumentInfo doc) throws XPathException { if (doc == null) { return null; } try { TransformerFactoryImpl factory = new TransformerFactoryImpl(context.getConfiguration()); return factory.newTemplates(doc); } catch (TransformerConfigurationException e) { throw XPathException.makeXPathException(e); } }
/** * Compile a document containing a stylesheet module into a stylesheet that can be used to perform * transformations * * @param context the XPath dynamic evaluation context * @param doc the document containing the stylesheet to be compiled * @return the compiled stylesheet */ public static Templates compileStylesheet(XPathContext context, DocumentInfo doc) throws XPathException { if (doc == null) { return null; } try { TransformerFactoryImpl factory = new TransformerFactoryImpl(context.getConfiguration()); return factory.newTemplates(doc); } catch (TransformerConfigurationException e) { throw XPathException.makeXPathException(e); } }
String xsl = "<e xsl:version='3.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform' " + "result='{Q{http://date.com}getFormattedNow()}'/>"; Templates t = factory.newTemplates(new StreamSource(new StringReader(xsl))); StringWriter sw = new StringWriter(); t.newTransformer().transform(new StreamSource(new StringReader("<a/>")), new StreamResult(sw));
Templates sheet = factory.newTemplates(style); if (showTime) { System.err.println("Prepared associated stylesheet " + style.getSystemId());
Templates sheet = factory.newTemplates(style); if (showTime) { System.err.println("Prepared associated stylesheet " + style.getSystemId());
Templates sheet = factory.newTemplates(styleSource);
sheet = (PreparedStylesheet)factory.newTemplates(styleSource); if (styleParser != null) { config.reuseStyleParser(styleParser);
Templates sheet = factory.newTemplates(styleSource);
sheet = (PreparedStylesheet)factory.newTemplates(styleSource); if (styleParser != null) { config.reuseStyleParser(styleParser);
next = (PreparedStylesheet)factory.newTemplates(source); preparedStylesheet.putCachedStylesheet(href, baseURI, next);
next = (PreparedStylesheet)factory.newTemplates(source); preparedStylesheet.putCachedStylesheet(href, baseURI, next);