cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robby Pelssers <>
Subject uniformity of passing parameters to components Cocoon 3
Date Thu, 07 Jul 2011 12:04:23 GMT
Hi all,

I noticed that the XSLTTransformer class has a separate setParameters method. So using pipeline.setup(outputstream,
params) will not work.  I can understand the reasoning behind this, but my initial understanding
was that you should use  pipelinecomponent.setup(params) for this.     But this seems to be
overridden when you invoke pipeline.setup(outputstream, params).

Can someone explain a bit high level what the proper way of working is?

    public void testPipelineWithCompiledXSLT() throws Exception {
        ByteArrayOutputStream baos = new ByteArrayOutputStream();

        Map<String, Object> attributes = new HashMap<String, Object>();
        attributes.put("translet-name", "CompiledXslt");
        attributes.put("package-name", "org.apache.cocoon.sax");

        Map<String, Object> transformerParams = new HashMap<String, Object>();
        transformerParams.put("myParam", "value-of-myparam");

        XSLTTransformer transformer = new XSLTTransformer(this.getClass().getResource("/test.xslt"),

            .setStarter(new XMLGenerator("<x></x>"))
            .setFinisher(new XMLSerializer())

        Diff diff = new Diff("<?xml version=\"1.0\" encoding=\"UTF-8\"?><p>value-of-myparam</p>",
new String(baos.toByteArray()));
        assertTrue("XSL transformation didn't work as expected " + diff, diff.identical());

View raw message