Examples of XsltTransformer


Examples of org.apache.cocoon.sax.component.XSLTTransformer

            parameters.put("startDate", reportExec.getStartDate());
            parameters.put("endDate", reportExec.getEndDate());

            switch (format) {
                case HTML:
                    XSLTTransformer xsl2html = new XSLTTransformer(getClass().getResource("/report/report2html.xsl"));
                    xsl2html.setParameters(parameters);
                    pipeline.addComponent(xsl2html);
                    pipeline.addComponent(XMLSerializer.createXHTMLSerializer());
                    break;

                case PDF:
                    XSLTTransformer xsl2pdf = new XSLTTransformer(getClass().getResource("/report/report2fo.xsl"));
                    xsl2pdf.setParameters(parameters);
                    pipeline.addComponent(xsl2pdf);
                    pipeline.addComponent(new FopSerializer(MimeConstants.MIME_PDF));
                    break;

                case RTF:
                    XSLTTransformer xsl2rtf = new XSLTTransformer(getClass().getResource("/report/report2fo.xsl"));
                    xsl2rtf.setParameters(parameters);
                    pipeline.addComponent(xsl2rtf);
                    pipeline.addComponent(new FopSerializer(MimeConstants.MIME_RTF));
                    break;

                case XML:
View Full Code Here

Examples of org.apache.cocoon.sax.component.XSLTTransformer

            OutputStream outputStream, URL... xsltUrls) throws Exception {
        Pipeline<SAXPipelineComponent> pipeline = new NonCachingPipeline<SAXPipelineComponent>();

        pipeline.addComponent(new XMLGenerator(xmlString));
        for (URL xsltUrl : xsltUrls) {
            XSLTTransformer xsltTransformer = new XSLTTransformer(xsltUrl);
            xsltTransformer.setParameters(xsltParameters);
            pipeline.addComponent(xsltTransformer);
        }

        if (outputProperties == null) {
            outputProperties = new Properties();
View Full Code Here

Examples of org.apache.cocoon.sax.component.XSLTTransformer

     */
    public LinkedSAXPipelineComponentBuilder addXSLTTransformer(URL source, Map<String, Object> attributes) {
        if (source == null) {
            throw new IllegalArgumentException("Parameter 'source' must be not null");
        }
        return this.addComponent(new XSLTTransformer(source, attributes));
    }
View Full Code Here

Examples of org.apache.cocoon.sax.component.XSLTTransformer

    @Test
    public void testPipelineWithFOPSerializer() throws Exception {
        Pipeline<SAXPipelineComponent> pipeline = new NonCachingPipeline<SAXPipelineComponent>();
        pipeline.addComponent(new XMLGenerator(this.getClass().getResource("page.xml")));
        pipeline.addComponent(new XSLTTransformer(this.getClass().getResource("page2fo.xsl")));
        pipeline.addComponent(new FopSerializer());

        File tmp = File.createTempFile("fop_test_case", ".pdf");
        FileOutputStream fos = new FileOutputStream(tmp);
        pipeline.setup(fos);
View Full Code Here

Examples of org.apache.cocoon.sax.component.XSLTTransformer

        attributes.put("translet-name", "CompiledXslt");
        attributes.put("package-name", "org.apache.cocoon.sax");

        newCachingPipeline()
            .setStarter(new XMLGenerator("<x></x>"))
            .addComponent(new XSLTTransformer(this.getClass().getResource("/test.xslt"), attributes))
            .setFinisher(new XMLSerializer())
            .withEmptyConfiguration()
            .setup(baos)
            .execute();
View Full Code Here

Examples of org.apache.cocoon.sax.component.XSLTTransformer

     * serializer.
     */
    public void testPipelineWithTransformer() throws Exception {
        Pipeline<SAXPipelineComponent> pipeline = new NonCachingPipeline<SAXPipelineComponent>();
        pipeline.addComponent(new XMLGenerator("<x></x>"));
        pipeline.addComponent(new XSLTTransformer(this.getClass().getResource("/test.xslt")));
        pipeline.addComponent(new XMLSerializer());

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        pipeline.setup(baos);
        pipeline.execute();
View Full Code Here

Examples of org.apache.cocoon.sax.component.XSLTTransformer

        attributes.put("translet-name", "CompiledXslt");
        attributes.put("package-name", "org.apache.cocoon.sax");

        Pipeline<SAXPipelineComponent> pipeline = new NonCachingPipeline<SAXPipelineComponent>();
        pipeline.addComponent(new XMLGenerator("<x></x>"));
        pipeline.addComponent(new XSLTTransformer(this.getClass().getResource("/test.xslt"), attributes));
        pipeline.addComponent(new XMLSerializer());

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        pipeline.setup(baos);
        pipeline.execute();
View Full Code Here

Examples of org.apache.cocoon.sax.component.XSLTTransformer

    @Test
    public void testPipelineWithFOPSerializer() throws Exception {
        Pipeline<SAXPipelineComponent> pipeline = new NonCachingPipeline<SAXPipelineComponent>();
        pipeline.addComponent(new XMLGenerator(this.getClass().getResource("page.xml")));
        pipeline.addComponent(new XSLTTransformer(this.getClass().getResource("page2fo.xsl")));
        pipeline.addComponent(new FopSerializer());

        File tmp = File.createTempFile("fop_test_case", ".pdf");
        FileOutputStream fos = new FileOutputStream(tmp);
        pipeline.setup(fos);
View Full Code Here

Examples of org.mule.module.xml.transformer.XsltTransformer

        MuleClient client = new MuleClient(muleContext);
        MuleMessage result = client.send(((InboundEndpoint) client.getMuleContext().getRegistry().lookupObject("httpEndpoint")).getAddress(),
            new DefaultMuleMessage(fileContents, muleContext));

        XsltTransformer trans = new XsltTransformer();
        trans.setMuleContext(muleContext);
        trans.setXslFile(NAME_STYLESHEET);
        trans.initialise();
        final byte[] locallyTransformedBytes = (byte[]) trans.doTransform(fileContents, "UTF-8");

        assertEquals(new String(locallyTransformedBytes), result.getPayloadAsString());
    }
View Full Code Here

Examples of org.mule.module.xml.transformer.XsltTransformer

        getAndTestTransformer("xmlToObject", XmlToObject.class);
    }

    public void testXslt()
    {
        XsltTransformer xslt = (XsltTransformer) getAndTestTransformer("xslt", XsltTransformer.class);
        assertEquals(10, xslt.getMaxActiveTransformers());
        assertEquals(10, xslt.getMaxIdleTransformers());
        assertEquals(CustomXsltTransformerFactory.class.getName(), xslt.getXslTransformerFactory());
        assertNull(xslt.getXslFile());
        assertNotNull(xslt.getXslt());
        String transform = xslt.getXslt();
        assertTrue(transform.indexOf("test for this string in test") > -1);

        assertEquals("#[header:foo]", xslt.getContextProperties().get("bar"));
    }
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.