Examples of XSLTProcessor


Examples of org.apache.xalan.xslt.XSLTProcessor

            } else {
                writer = new StringWriter();
            }

            // Use XSLTProcessorFactory to instantiate an XSLTProcessor.
            XSLTProcessor processor = XSLTProcessorFactory.getProcessor();

            // Create the 3 objects the XSLTProcessor needs to perform the transformation.
            // Fix up the args...
            XMLParserLiaison xmlPL = processor.getXMLProcessorLiaison();
            URL urlTmp = xmlPL.getURLFromString(foFile, null);
            MessageHandler.errorln("xml: " + urlTmp);
            XSLTInputSource xmlSource =
              new XSLTInputSource (urlTmp.toString());
            urlTmp = xmlPL.getURLFromString(xsltFile, null);
            MessageHandler.errorln("xslt: " + urlTmp);
            XSLTInputSource xslSheet =
              new XSLTInputSource (urlTmp.toString());

            XSLTResultTarget xmlResult = new XSLTResultTarget (writer);

            // Perform the transformation.
            processor.process(xmlSource, xslSheet, xmlResult);

            if (usefile) {
                reader = new FileReader(pdfFile + ".tmp");
            } else {
                // create a input source containing the xsl:fo file which can be fed to Fop
View Full Code Here

Examples of org.apache.xalan.xslt.XSLTProcessor

*
* @ant.task ignore="true"
*/
public class Xalan1Executor extends XalanExecutor {
    void execute() throws Exception {
        XSLTProcessor processor = XSLTProcessorFactory.getProcessor();
        // need to quote otherwise it breaks because of "extra illegal tokens"
        processor.setStylesheetParam("output.dir", "'" + caller.toDir.getAbsolutePath() + "'");
        XSLTInputSource xml_src = new XSLTInputSource(caller.document);
        String system_id = caller.getStylesheetSystemId();
        XSLTInputSource xsl_src = new XSLTInputSource(system_id);
        OutputStream os = getOutputStream();
        try {
            XSLTResultTarget target = new XSLTResultTarget(os);
            processor.process(xml_src, xsl_src, target);
        } finally {
            os.close();
        }
    }
View Full Code Here

Examples of org.apache.xalan.xslt.XSLTProcessor

*
* @ant.task ignore="true"
*/
public class Xalan1Executor extends XalanExecutor {
    void execute() throws Exception {
        XSLTProcessor processor = XSLTProcessorFactory.getProcessor();
        // need to quote otherwise it breaks because of "extra illegal tokens"
        processor.setStylesheetParam("output.dir", "'" + caller.toDir.getAbsolutePath() + "'");
        XSLTInputSource xml_src = new XSLTInputSource(caller.document);
        String system_id = caller.getStylesheetSystemId();
        XSLTInputSource xsl_src = new XSLTInputSource(system_id);
        OutputStream os = getOutputStream();
        try {
            XSLTResultTarget target = new XSLTResultTarget(os);
            processor.process(xml_src, xsl_src, target);
        } finally {
            os.close();
        }
    }
View Full Code Here

Examples of org.apache.xalan.xslt.XSLTProcessor

  public static void main(String[] args)
    throws java.io.IOException,
           java.net.MalformedURLException,
           org.xml.sax.SAXException
  {
    XSLTProcessor processor = XSLTProcessorFactory.getProcessor();
   
    XSLTInputSource xmlID = new XSLTInputSource("foo.xml");
    XSLTInputSource stylesheetID = new XSLTInputSource("foo.xsl");
    Document out = new org.apache.xerces.dom.DocumentImpl();
    XSLTResultTarget resultTarget = new XSLTResultTarget(out);
    processor.process(xmlID, stylesheetID, resultTarget);
   
    PrintWriter pw = new PrintWriter( System.out );
    FormatterToXML fl = new FormatterToXML(pw, true);
    TreeWalker tw = new TreeWalker(fl);
    tw.traverse(out);
View Full Code Here

Examples of org.apache.xalan.xslt.XSLTProcessor

           java.net.MalformedURLException,
           org.xml.sax.SAXException
  {
    // Have the XSLTProcessorFactory obtain a interface to a
    // new XSLTProcessor object.
    XSLTProcessor processor = XSLTProcessorFactory.getProcessor();
   
    // Have the XSLTProcessor processor object transform "foo.xml" to
    // System.out, using the XSLT instructions found in "foo.xsl".
    processor.process(new XSLTInputSource("foo.xml"),
                      new XSLTInputSource("foo.xsl"),
                      new XSLTResultTarget(System.out));
  }
View Full Code Here

Examples of org.apache.xalan.xslt.XSLTProcessor

  public static void main(String[] args)
    throws java.io.IOException,
           java.net.MalformedURLException,
           org.xml.sax.SAXException
  {
    XSLTProcessor processor = XSLTProcessorFactory.getProcessor("foo.xsl");
    XSLTProcessor processor2 = XSLTProcessorFactory.getProcessor("foo2.xsl");
  
    SAXParser parser = new SAXParser();
   
    parser.setDocumentHandler(processor);
    processor.setDocumentHandler(processor2);
    processor2.setOutputStream(System.out);
   
    parser.parse(new InputSource("foo.xml"));
  }
View Full Code Here

Examples of org.apache.xalan.xslt.XSLTProcessor

      return;
    }
   
    // Have the XSLTProcessorFactory obtain a interface to a
    // new XSLTProcessor object.
    XSLTProcessor processor = XSLTProcessorFactory.getProcessor();
   
    // Set a param named "param1", that the stylesheet can obtain.
    processor.setStylesheetParam("param1", processor.createXString(args[0]));
       
    System.out.println("------------------");
    // Have the XSLTProcessor processor object transform "foo.xml" to
    // System.out, using the XSLT instructions found in "foo.xsl".
    processor.process(new XSLTInputSource("file:foo.xml"),
                      new XSLTInputSource("file:foo.xsl"),
                      new XSLTResultTarget(System.out));
    System.out.println("\n------------------");
  }
View Full Code Here

Examples of org.apache.xalan.xslt.XSLTProcessor

    /**
     * Compile a new StylesheetRoot from an input file.
     */
    protected StylesheetRoot compileStylesheetRoot (String source) throws Exception
    {
        XSLTProcessor processor = XSLTProcessorFactory.getProcessor();
       
        XSLTInputSource xslin = new XSLTInputSource("file:///"+source);
        StylesheetRoot root = processor.processStylesheet(xslin);

        return root;
    }
View Full Code Here

Examples of org.apache.xalan.xslt.XSLTProcessor

    /**
     * Execute an xslt
     */
    public void transform (String xslName, Reader in, Writer out) throws Exception
    {
        XSLTProcessor processor = XSLTProcessorFactory.getProcessor();
        XSLTInputSource xmlin = new XSLTInputSource(in);
        XSLTResultTarget xmlout = new XSLTResultTarget(out);
       
        transform (xslName,processor,xmlin,xmlout);       
    }
View Full Code Here

Examples of org.apache.xalan.xslt.XSLTProcessor

    /**
     * Execute an xslt
     */
    public void transform (String xslName, org.w3c.dom.Node in, Writer out) throws Exception
    {
        XSLTProcessor processor = XSLTProcessorFactory.getProcessor();
        XSLTInputSource xmlin = new XSLTInputSource(in);
        XSLTResultTarget xmlout = new XSLTResultTarget(out);
       
        transform (xslName,processor,xmlin,xmlout);       
    }
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.