You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by gr...@daimlerchrysler.com on 2003/09/02 09:10:08 UTC

getting parameters from the sitemap for my own transformer

Hello,

i have written a transformer which is needed for my project. This
transformer has to work in two modes which should be specified by a
parameter passed in the sitemap:

-- this is what i wrote in my sitemap --

<map:transformer name="acltransformer" src=
"com.daimlerchrysler.mediathek.acl.ACLTransformer">
</map:transformer>

...

<map:transform type="acltransformer">
   <map:parameter name="ignore_type" value="true"/>
</map:transform>

----

-- this is what i wrote in my transformer --

public class ACLTransformer extends AbstractSAXTransformer implements
Parameterizable, Poolable
{
...

public void parameterize(Parameters parameters) throws ParameterException
{
      this.ignore_type = parameters.getParameterAsBoolean("ignore_type",
false);
}

----

The value of my Boolean variable ignore_type is set to false, which means
that the parameter from the sitemap couldn' t be passed to my class.

I think the way I use the interface Parameterizable is correct and i' d
like to know if i have to do further modifications to my sitemap or perhaps
to the cocoon.xconf file.

Thank you for your help.

Gregor Bertrand



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: getting parameters from the sitemap for my own transformer

Posted by Ramy Mamdouh <ra...@imkenberg.de>.
Hi Gregor,

Try ovveride the method setup() in your transformer, in in you get the 
Parameters object.

public void setup( SourceResolver sourceResolver, Map map, String 
string, Parameters parameters ){

	//here, you can access the parameters object.
}

Hope that helps you.

Ramy

gregor.bertrand@daimlerchrysler.com wrote:
> Hello,
> 
> i have written a transformer which is needed for my project. This
> transformer has to work in two modes which should be specified by a
> parameter passed in the sitemap:
> 
> -- this is what i wrote in my sitemap --
> 
> <map:transformer name="acltransformer" src=
> "com.daimlerchrysler.mediathek.acl.ACLTransformer">
> </map:transformer>
> 
> ...
> 
> <map:transform type="acltransformer">
>    <map:parameter name="ignore_type" value="true"/>
> </map:transform>
> 
> ----
> 
> -- this is what i wrote in my transformer --
> 
> public class ACLTransformer extends AbstractSAXTransformer implements
> Parameterizable, Poolable
> {
> ...
> 
> public void parameterize(Parameters parameters) throws ParameterException
> {
>       this.ignore_type = parameters.getParameterAsBoolean("ignore_type",
> false);
> }
> 
> ----
> 
> The value of my Boolean variable ignore_type is set to false, which means
> that the parameter from the sitemap couldn' t be passed to my class.
> 
> I think the way I use the interface Parameterizable is correct and i' d
> like to know if i have to do further modifications to my sitemap or perhaps
> to the cocoon.xconf file.
> 
> Thank you for your help.
> 
> Gregor Bertrand
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org