Examples of newTemplates()


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

      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

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

      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

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

    try
    {
      // Instantiate the TransformerFactory, and use it along with a SteamSource
      // XSL stylesheet to create a translet as a Templates object.
      TransformerFactory tFactory = TransformerFactory.newInstance();
      Templates translet = tFactory.newTemplates(new StreamSource(xslInURI));
   
      // Perform each transformation
      doTransform(translet, "../../xsltc_todo.xml", "todo-xsltc.html");
      System.out.println("Produced todo-xsltc.html");
   
View Full Code Here

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

            }

            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

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

                    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

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

          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

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

     
      //initialize transformer for pretty print xslt
      TransformerFactory tFactory = TransformerFactory.newInstance ();
      String prettyPrintXslt = FITS_XML+"prettyprint.xslt";
      try {
      Templates template = tFactory.newTemplates(new StreamSource(prettyPrintXslt));     
      transformer = template.newTransformer();
      }
      catch(Exception e) {
        transformer = null;
      }
View Full Code Here

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

      InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(xslPath);
      try
      {
         StreamSource ss = new StreamSource(is);
         ss.setSystemId(xslPath);
         templates = tf.newTemplates(ss);
         log.debug("Created templates: " + templates);
      }
      finally
      {
         try
View Full Code Here

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

                    LOG.debug("Preparing XSLT stylesheet templates: " + path);
                }

                TransformerFactory factory = TransformerFactory.newInstance();
                factory.setURIResolver(getURIResolver());
                templates = factory.newTemplates(new StreamSource(resource.openStream()));
                templatesCache.put(path, templates);
            }
        }

        return templates;
View Full Code Here

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

        if (translet == null) {
            String templateUrl = (String)context.get("templateUrl");
            String templateString = (String)context.get("templateString");
            Document templateDocument = (Document)context.get("templateDocument");
            Source templateSource = getSource(templateDocument, templateUrl, templateString);
            translet = tFactory.newTemplates(templateSource);
            if (UtilValidate.isNotEmpty(templateName)) {
                    xslTemplatesCache.put(templateName, translet);
            }
        }
        if (translet != null) {
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.