cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thorsten Scherler <>
Subject Re: [c3] Implementing presentation logic in c3
Date Fri, 28 Oct 2011 10:58:55 GMT
On Fri, 2011-10-28 at 11:31 +0200, Francesco Chicchiriccò wrote:
> Thorsten,
> see attached a patch for cocoon-stringtemplate and cocoon-sample that 
> should fix your issue about $if$ with StringTemplateTransformer.
> In fact, I've checked that problems arise with transformer only, while 
> generator is safe in this respect; this happens because generator let ST 
> handle the whole file, while transformer doesn't. Transformer's approach 
> makes it able, however, to parse ST expressions in XML attributes as well.
> If you want to try my patch, just apply it to fresh C3 sources, do an 
> "mvn clean install" of cocoon-stringtemplate and afterwards launch "mvn 
> jetty:run" under cocoon-sample: you will be able to watch results at 
> http://localhost:8888/string-template/generator and 
> http://localhost:8888/string-template/transformer.
> I did not commit this yet because, as you can see from 
> StringTemplateTransformer's source, my patch is limited to "$if$" case, 
> and only when the whole $if$ evaluates to CDATA from XML point of view: 
> i.e. this work
> <root>
> <a alt="$parameter$" href="$if(!booleanParameter)$
> expression evaluated to true
> $else$
> expression evaluated to false
> $endif$">link</a>
> </root>
> while this does not:
> <root>
> $if(!booleanParameter)$
> <element>expression evaluated to true</element>
> $else$
> <element>expression evaluated to false</element>
> $endif$
> </root>

I patched only the transformer, here my observation:
- the attribute approach works fine.
- the second one cuts of element generation from that point on.

it is a start. ;)

Thorsten Scherler <>
codeBusters S.L. - web based systems
<consulting, training and solutions>

View raw message