Package org.apache.xalan.xslt

Examples of org.apache.xalan.xslt.XSLTInputSource


    public void setStylesheet(String fileName) throws Exception {
        xslSheet = new XSLTInputSource (normalize(fileName));
    };

    public void transform(String infile, String outfile) throws Exception {
        processor.process(new XSLTInputSource(normalize(infile)), xslSheet,
                        new XSLTResultTarget(outfile));
    }
View Full Code Here


     * @throws SAXException SAX Parsing Error on the style Sheet.
     */
    protected void transform(Node root, String xslname, String htmlname) throws SAXException {
        try{
            final long t0 = System.currentTimeMillis();
            XSLTInputSource xsl_source = getXSLStreamSource(xslname);
            XSLTProcessor processor = XSLTProcessorFactory.getProcessor();
            File htmlfile = new File(toDir, htmlname);
            // create the directory if it does not exist
            File dir = new File(htmlfile.getParent()); // getParentFile is in JDK1.2+
            if (!dir.exists()) {
                dir.mkdirs();
            }
            task.log("Applying '" + xslname + "'. Generating '" + htmlfile + "'", Project.MSG_VERBOSE);
            processor.process( new XSLTInputSource(root), xsl_source, new XSLTResultTarget(htmlfile.getAbsolutePath()) );
            final long dt = System.currentTimeMillis() - t0;
            task.log("Transform time for " + xslname + ": " + dt + "ms");
        } catch (IOException e){
            task.log(e.getMessage(), Project.MSG_ERR);
            e.printStackTrace(); //@todo bad, change this
View Full Code Here

        } else {
            File f = new File(styleDir, name);
            in= new FileInputStream(f);
            systemId = f.getAbsolutePath();
        }
        XSLTInputSource ss = new XSLTInputSource(in);
        ss.setSystemId(systemId);
        return ss;
    }
View Full Code Here

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 {
View Full Code Here

            xslStream = new FileInputStream(stylesheet);
            fis = new FileInputStream(infile);
            fos = new FileOutputStream(outfile);
            // systemid such as file:/// + getAbsolutePath() are considered
            // invalid here...
            XSLTInputSource xslSheet = new XSLTInputSource(xslStream);
            xslSheet.setSystemId(stylesheet.getAbsolutePath());
            XSLTInputSource src = new XSLTInputSource(fis);
            src.setSystemId(infile.getAbsolutePath());
            XSLTResultTarget res = new XSLTResultTarget(fos);
            processor.process(src, xslSheet, res);
        } finally {
            // make sure to close all handles, otherwise the garbage
            // collector will close them...whenever possible and
View Full Code Here

            Iterator it = sl.iterator();
            while (it.hasNext()) {
                String uri = (String)it.next();
                Node n = (Node)it.next();

                XSLTInputSource is = new XSLTInputSource(n);
                is.setSystemId(uri);
                StylesheetRoot ss = p.processStylesheet(is);

                StringWriter w = new StringWriter();

                ss.process(new XSLTInputSource(r), new XSLTResultTarget(w));
                r = new StringReader(w.getBuffer().toString());
            }

            /*
            Processor p = Processor.newInstance("xslt");
View Full Code Here

TOP

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

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.