Package com.xmlcalabash.config

Examples of com.xmlcalabash.config.CssProcessor


        String cssClass = runtime.getConfiguration().cssProcessor;
        if (cssClass == null) {
            throw new XProcException("No CSS processor class defined");
        }

        final CssProcessor provider;
        try {
            provider = (CssProcessor) Class.forName(cssClass).newInstance();
            provider.initialize(runtime,step,options);
        } catch (Exception e) {
            logger.debug(e.getMessage(), e);
            throw new XProcException(step.getNode(), "Failed to instantiate CSS provider");
        }

        while (css.moreDocuments()) {
            XdmNode style = css.read();
            provider.addStylesheet(style);
        }

        final String contentType;
        if (getOption(_content_type) != null) {
            contentType = getOption(_content_type).getString();
        } else {
            contentType = "application/pdf";
        }

        String href = getOption(_href).getString();
        String base = getOption(_href).getBaseURI().toASCIIString();

        try {
            DataStore store = runtime.getDataStore();
            URI id = store.writeEntry(href, base, contentType, new DataWriter() {
                public void store(OutputStream out) throws IOException {
                    try {
                        provider.format(source.read(),out,contentType);
                    } catch(SaxonApiException e) {
                        throw new IOException(e);
                    }
                }
            });
View Full Code Here

TOP

Related Classes of com.xmlcalabash.config.CssProcessor

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.