Return-Path: X-Original-To: apmail-cocoon-dev-archive@www.apache.org Delivered-To: apmail-cocoon-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C5BBB4D1C for ; Thu, 7 Jul 2011 15:27:40 +0000 (UTC) Received: (qmail 52298 invoked by uid 500); 7 Jul 2011 15:27:40 -0000 Delivered-To: apmail-cocoon-dev-archive@cocoon.apache.org Received: (qmail 51656 invoked by uid 500); 7 Jul 2011 15:27:39 -0000 Mailing-List: contact dev-help@cocoon.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: dev@cocoon.apache.org List-Id: Delivered-To: mailing list dev@cocoon.apache.org Received: (qmail 51254 invoked by uid 99); 7 Jul 2011 15:27:39 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 Jul 2011 15:27:39 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of simone.tripodi@gmail.com designates 209.85.218.51 as permitted sender) Received: from [209.85.218.51] (HELO mail-yi0-f51.google.com) (209.85.218.51) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 Jul 2011 15:27:34 +0000 Received: by yib2 with SMTP id 2so544857yib.24 for ; Thu, 07 Jul 2011 08:27:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type :content-transfer-encoding; bh=+0p5v+OonMv5DZoK6A0UIFUogQ5I0lBIxzxxzislkMU=; b=L0twmmk8hbA2upD2DNod4RVQJ+AhlNz5lXXMH89MODB+95YjChl17/l7W9deCQimmv lHGO/rCpt3J889RRFzQWtiDb3lcwgsoVsekOceuXDDSureSqK0oGZJR6+lI9+x4hnXLH PcKfJsHKKV3fj8LcSqbSe7fxm6rLAQ8UFd/9Q= MIME-Version: 1.0 Received: by 10.150.163.17 with SMTP id l17mr1131496ybe.71.1310052433494; Thu, 07 Jul 2011 08:27:13 -0700 (PDT) Sender: simone.tripodi@gmail.com Received: by 10.151.9.9 with HTTP; Thu, 7 Jul 2011 08:27:13 -0700 (PDT) In-Reply-To: <78B923726E7D59429936580CF127E943A15C1E9E26@eu1rdcrdc1wx032.exi.nxp.com> References: <78B923726E7D59429936580CF127E943A15C1E9E26@eu1rdcrdc1wx032.exi.nxp.com> Date: Thu, 7 Jul 2011 17:27:13 +0200 X-Google-Sender-Auth: A29IOo_raYYj8RB90va0lKgDI6w Message-ID: Subject: Re: uniformity of passing parameters to components Cocoon 3 From: Simone Tripodi To: dev@cocoon.apache.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi Robby, I'm worried about the {{withEmptyConfiguration()}} call, it should reset the {{transformerParams.put("myParam", "value-of-myparam");}} invocation; would you mind to modify and test your code as shown below? Many thanks in advance, have a nice day! Simo public void testPipelineWithCompiledXSLT() throws Exception { ByteArrayOutputStream baos =3D new ByteArrayOutputStream(); Map transformerParams =3D new HashMap(); transformerParams.put("myParam", "value-of-myparam"); XSLTTransformer transformer =3D new XSLTTransformer(this.getClass().getResource("/test.xslt"), attributes); transformer.setParameters(transformerParams); newCachingPipeline() .setStarter(new XMLGenerator("")) .addComponent(new XSLTTransformer(this.getClass().getResource("/test.xslt"), attributes)) .setFinisher(new XMLSerializer()) .setConfiguration(transformerParams) .setup(baos) .execute(); Diff diff =3D new Diff("

value-of-myparam

", new String(baos.toByteArray())); assertTrue("XSL transformation didn't work as expected " + diff, diff.identical()); } http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Thu, Jul 7, 2011 at 2:04 PM, Robby Pelssers wro= te: > Hi all, > > > > I noticed that the XSLTTransformer class has a separate setParameters > method. So using pipeline.setup(outputstream, params) will not work. =C2= =A0I can > understand the reasoning behind this, but my initial understanding was th= at > you should use=C2=A0 pipelinecomponent.setup(params) for this.=C2=A0=C2= =A0 =C2=A0=C2=A0But 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? > > > > > > > > =C2=A0=C2=A0=C2=A0 public void testPipelineWithCompiledXSLT() throws Exce= ption { > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ByteArrayOutputStream baos =3D= new ByteArrayOutputStream(); > > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Map attributes= =3D new HashMap(); > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 attributes.put("translet-name"= , "CompiledXslt"); > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 attributes.put("package-name",= "org.apache.cocoon.sax"); > > > > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0Map trans= formerParams =3D new HashMap Object>(); > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 transformerParams.put("myParam= ", "value-of-myparam"); > > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0XSLTTransformer transform= er =3D new > XSLTTransformer(this.getClass().getResource("/test.xslt"), attributes); > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 transformer.setParameters(tran= sformerParams); > > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0newCachingPipeline() > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 .setSt= arter(new XMLGenerator("")) > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 .addCo= mponent(transformer) > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 .setFi= nisher(new XMLSerializer()) > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 .withE= mptyConfiguration() > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 .setup= (baos) > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 .execu= te(); > > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Diff diff =3D new Diff(" encoding=3D\"UTF-8\"?>

value-of-myparam

", new > String(baos.toByteArray())); > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 assertTrue("XSL transformation= didn't work as expected " + diff, > diff.identical()); > > =C2=A0=C2=A0=C2=A0 }