cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Leszek Gawron <>
Subject Re: cocoon-template incompatible change
Date Mon, 27 Aug 2007 08:54:08 GMT
Grzegorz Kossakowski wrote:
> Leszek Gawron pisze:
>> Grzegorz Kossakowski wrote:
>>> Simply removing this instructions is not the best option because there
>>> would be a lot of junk
>>> (namespace declarations) laying in Object Model when, in fact, we
>>> would be out of this namespaces.
>> Doesn't NamespacesTable take care of that?
> It does but it's really not clear that we put object (NamespacesTable) on ObjectModel
and modify it
> afterwards. That's why I decided to put it again every time it is modified to keep everything
> clean as possible.
> I saw that you removed this from StartPrefixMapping. I would like to strongly underline
that it's
> *not* reliable solution because it does *not* fix all scoping problems but only the one
you have
> come with.
> With template code following:
> <root>
> <jx:if test="true">
>   <jx:set var="foo" value="bar"/>
> </jx:if>
> <test>${foo}</test>
> </root>
> Will result as:
> <root>
> <test>bar</test>
> </root>
> instead of:
> <root>
> <test/>
> </root>

I may be biased but I would expect exactly the first case. I made a 
mistake in previous mail proposing jx:if to be scoped. Please mind that 
jx:set always puts a variable in current scope so you are not able to 
change variable value:

<jx:set var="foo" value="bar"/>
<jx:if test="true">
   <jx:set var="foo" value="bazzz"/>

should result in <test>bazzz</test> otherwise people will get very 
confused. A common user won't find the case much different from:

<jx:set var="foo" value="bar"/>
<jx:set var="foo" value="bazzz"/>

which in turn works as expected.

Long time ago we have already discussed about introducing jx:declare 
along with jx:set. I cannot recall if any consensus was met.

Leszek Gawron               
CTO at MobileBox Ltd.

View raw message