cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Fagerstrom <dani...@nada.kth.se>
Subject Re: jx:text
Date Fri, 20 Jan 2006 12:37:40 GMT
The functionality seem useful, but I don't think that it should be 
implemented as an attribute. An attribute template language would be 
cool, but, for JXTG, I think that all instructions should be elements. 
Mixing element and attribute instructions makes the template language 
confusing IMO.

 From architectural stand point I would prefer letting the strip 
whitespace element just work on its immediate children. Striping 
whitespace recursively means that we need to make the Template 
architecture more complicated and less reusable, I'm not convinced that 
it would be worthwhile.

/Daniel

Reinhard Poetz wrote:
>
> I had a discussion with Leszek about whitespaces in cTemplate. He made 
> a proposal about solving the problem once and for all. Comments are 
> welcome!
>
> Leszek Gawron wrote:
>> Reinhard,
>>
>> I hope you don't mind bringing this to public list. I'd like others 
>> to comment on my proposal.
>>
>> Reinhard Poetz wrote:
>>
>>> Leszek Gawron wrote:
>>>
>>>> Hello,
>>>>
>>>> Reinhard Poetz wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> I would need to have something similar to xsl:text in cTemplate. 
>>>>> What do you think, is it difficult (for me) to implement jx:text?
>>>>
>>>>
>>>>
>>>> Could you give me some usecase?
>>>>
>>>> Do you need your <jx:text/> not to resolve expressions like:
>>>> <jx:text>${this goes as it looks even without matching brace 
>>>> </jx:text>
>>>>
>>>> It is fairly easy to create new instructions. I could do it for you 
>>>> though if you gave me your requirements.
>>>>
>>>>     lg
>>>>
>>>
>>> It's about stripping of whitesapces:
>>>
>>> <jx:forEach ...>
>>>   <xyz>
>>>     ${abc.name}
>>>   </xyz>
>>> </jx:forEach>
>>>
>>> That leads to
>>>
>>> <xyz>
>>>    name_1
>>> </xyz>
>>> <xyz>
>>>    name_2
>>> </xyz>
>>>
>>> What I'd need is
>>>
>>> <xyz>name_1</xyz>
>>> <xyz>name_2</xyz>
>>>
>>> I know, using another formatting in the template, this can be worked 
>>> around, but  sometimes this isn't readable anymore (who want's to 
>>> study lines of 200 characters).
>>>
>>> Do you know what I mean?
>>
>>
>> Yes .. but isn't it just the opposite to xsl:text? xsl:text is about 
>> preserving whitespace and not removeing it. Another question for you 
>> is: how would you like this to be handled:
>>
>> <jx:forEach ...>
>>   <xyz>
>>     ${abc.name}
>>     <nested-tag>            ${abc.description}             </nested-tag>
>>   </xyz>
>> </jx:forEach>
>>
>> should nested-tag also have whitespace stripped? If this 
>> functionality should be inherited we could have something like:
>>
>> <xyz jx:strip-whitespace="true">
>>   ${abc.name}
>>   <nested-tag>            ${abc.description}             </nested-tag>
>> </xyz>
>>
>> which would lead to:
>> <xyz 
>> jx:strip-whitespace="true">name_1<nested-tag>desc</nested-tag></xyz>
>>
>> we could also introduce jx:strip-whitespace stack so you could 
>> override your setting in deeper section of the document
>>
>> <xyz jx:strip-whitespace="true">
>>   ${abc.name}
>>   <nested-tag jx:strip-whitespace="false"> 
>> ${abc.description}             </nested-tag>
>> </xyz>
>>
>> That would give you:
>>
>> <xyz jx:strip-whitespace="true">name_1<nested-tag>         desc     
 
>> </nested-tag></xyz>
>>
>> (this might be unreadable because my thunderbird tries to outsmart me:))
>>
>>
>> in general it could be: <jx:strip-space="true|false|inherit"> (where 
>> inherit is something that equals to no jx-strip-space attr).
>>
>> whitespace problem affects separate .jx files with macros - you get a 
>> loooooot of whitespace imported into your document. We should come up 
>> with some generic functionality about preserving/keeping whitespace.
>>
>> I suppose <jx:import uri="view/macros.jx" 
>> jx:strip-whitespace="true"/> could be of great use for macros only 
>> inclusions.
>>
>> WDYT?
>
>     
>
>     
>        
> ___________________________________________________________ Telefonate 
> ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de


Mime
View raw message