Package org.apache.xalan.xslt

Examples of org.apache.xalan.xslt.XSLTProcessor


     XSLTInputSource XSLinput = new XSLTInputSource (readerInput);

  StringWriter outBuffer = new StringWriter();
  XSLTResultTarget XSLoutput = new XSLTResultTarget(outBuffer)
try {
  XSLTProcessor processor = XSLTProcessorFactory.getProcessor();
  processor.process(XSLinput, new XSLTInputSource(templateName),
                          XSLoutput);
} catch (Exception e) {
  e.printStackTrace();
}
  String result = XSLoutput.getCharacterStream().toString();
View Full Code Here


  StringWriter outBuffer = new StringWriter();
  XSLTResultTarget XSLoutput = new XSLTResultTarget(outBuffer)
try {
  // Set up the XSLTProcessor to use XercesLiaison.
  XSLTProcessor processor = XSLTProcessorFactory.getProcessor
                                  (new org.apache.xalan.xpath.xdom.XercesLiaison());

  processor.process(XSLinput, new XSLTInputSource(templateName),
                          XSLoutput);
} catch (Exception e) {
  e.printStackTrace();
}
  String result = XSLoutput.getCharacterStream().toString();
View Full Code Here

  private String doXML(String newsURL) throws IOException {
     
  StringWriter wrt = new StringWriter();
                                                       
    try{
          XSLTProcessor processor = XSLTProcessorFactory.getProcessor();
   
  
          processor.process(new XSLTInputSource(newsURL),
                            new XSLTInputSource("http://home.nordija.dk/news.xsl"),
                            new XSLTResultTarget(wrt));
  
   
         }
View Full Code Here

            } 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

*
* @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

*
* @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

  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

           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

  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

      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

TOP

Related Classes of org.apache.xalan.xslt.XSLTProcessor

Copyright © 2018 www.massapicom. 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.