Package javax.xml.transform

Examples of javax.xml.transform.TransformerFactory.newTemplates()


            dfactory.setNamespaceAware(true);

            DocumentBuilder docBuilder = dfactory.newDocumentBuilder();
            Node xslDOM = docBuilder.parse(new InputSource(xslFileName));

            stylesheet = tfactory.newTemplates(new DOMSource(xslDOM,
                    xslFileName));
          }
          else
          {
            // System.out.println("Calling newTemplates: "+xslFileName);
View Full Code Here


                    xslFileName));
          }
          else
          {
            // System.out.println("Calling newTemplates: "+xslFileName);
            stylesheet = tfactory.newTemplates(new StreamSource(xslFileName));
            // System.out.println("Done calling newTemplates: "+xslFileName);
          }
        }

        PrintWriter resultWriter;
View Full Code Here

          Source source =
            stf.getAssociatedStylesheet(new StreamSource(inFileName), media,
                                        null, null);

          if (null != source)
            stylesheet = tfactory.newTemplates(source);
          else
          {
            if (null != media)
              throw new TransformerException(XSLMessages.createMessage(XSLTErrorResources.ER_NO_STYLESHEET_IN_MEDIA, new Object[]{inFileName, media})); //"No stylesheet found in: "
                                            // + inFileName + ", media="
View Full Code Here

            dfactory.setNamespaceAware(true);

            DocumentBuilder docBuilder = dfactory.newDocumentBuilder();
            Node xslDOM = docBuilder.parse(new InputSource(xslFileName));

            stylesheet = tfactory.newTemplates(new DOMSource(xslDOM,
                    xslFileName));
          }
          else
          {
            // System.out.println("Calling newTemplates: "+xslFileName);
View Full Code Here

                    xslFileName));
          }
          else
          {
            // System.out.println("Calling newTemplates: "+xslFileName);
            stylesheet = tfactory.newTemplates(new StreamSource(xslFileName));
            // System.out.println("Done calling newTemplates: "+xslFileName);
          }
        }

        PrintWriter resultWriter;
View Full Code Here

          Source source =
            stf.getAssociatedStylesheet(new StreamSource(inFileName), media,
                                        null, null);

          if (null != source)
            stylesheet = tfactory.newTemplates(source);
          else
          {
            if (null != media)
              throw new TransformerException(XSLMessages.createMessage(XSLTErrorResources.ER_NO_STYLESHEET_IN_MEDIA, new Object[]{inFileName, media})); //"No stylesheet found in: "
                                            // + inFileName + ", media="
View Full Code Here

            Assert.isTrue(requestXslt.exists(), "requestXslt \"" + requestXslt + "\" does not exit");
            if (logger.isInfoEnabled()) {
                logger.info("Transforming request using " + requestXslt);
            }
            Source requestSource = new ResourceSource(xmlReader, requestXslt);
            requestTemplates = transformerFactory.newTemplates(requestSource);
        }
        if (responseXslt != null) {
            Assert.isTrue(responseXslt.exists(), "responseXslt \"" + responseXslt + "\" does not exit");
            if (logger.isInfoEnabled()) {
                logger.info("Transforming response using " + responseXslt);
View Full Code Here

            Assert.isTrue(responseXslt.exists(), "responseXslt \"" + responseXslt + "\" does not exit");
            if (logger.isInfoEnabled()) {
                logger.info("Transforming response using " + responseXslt);
            }
            Source responseSource = new ResourceSource(xmlReader, responseXslt);
            responseTemplates = transformerFactory.newTemplates(responseSource);
        }
    }
}
View Full Code Here

      tFactory.setURIResolver(new SystemIdResolver(loader).asURIResolver());
      tFactory.setErrorListener(xmllog);
      final StreamSource src = new StreamSource(loader.openResource(fn),
        SystemIdResolver.createSystemIdFromResourceName(fn));
      try {
        result = tFactory.newTemplates(src);
      } finally {
        // some XML parsers are broken and don't close the byte stream (but they should according to spec)
        IOUtils.closeQuietly(src.getInputStream());
      }
    } catch (Exception e) {
View Full Code Here

      StreamSource stylesheet = new StreamSource(xsl);

      // The TransformerFactory will compile the stylesheet and
      // put the translet classes inside the Templates object
      TransformerFactory factory = TransformerFactory.newInstance();
      Templates templates = factory.newTemplates(stylesheet);

      // Send the Templates object to a '.translet' file
      dumpTemplate(getBaseName(xsl)+".translet", templates);
        }
  catch (Exception e) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.