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: [RT] Attribute Driven Templates
Date Sat, 04 Dec 2004 18:31:43 GMT
Jonas Ekstedt wrote:
> On Sat, 4 Dec 2004, Daniel Fagerstrom wrote:
> 
> snip...
> 
>>if(<test>)
>>----------
>>
>>example:
>>
>><div do="if(count(cart/item) == 0)">
>>   Your cart is empty
>><div>
>>
> 
> How would you implement choose/when?

I woudn't, don't think it works that well with Dreamweaver and such 
things. You can use a number of if instead. I would also assume that 
there is an upper bound on complexity when "fill in the blanks"-style 
templating isn't feasible anymore and when it becomes more or less 
meaningsless to try to edit it in dreamweaver. In such cases rule based 
templates are better.

Anyway, my Dreamweaver experience is quite limited, I used it for 
implementing a site design from Illustrator to HTML and CSS. It was fun 
for a short while. But I'm not the right kind of person for using 
dreamweaver. I'm fanatic in avoiding any style elements in HTML so I do 
everything in CSS and DWs CSS support didn't impress me. So after a 
while I went back to emacs again :)

Hopefully people that have succeded in using DW to their advantage will 
tell whats needed and usefull.


> snip...
> 
>>Several directives
>>------------------
>>
>>So, how do we handle multiple directives for one element? We could
>>handle the TAL example above like:
>>
>><p
>>do="let(x=/a/long/path/from/the/root;if(x);content(x/txt);attributes(class=x/class)">
>>   Ex Text
>></p>
> 
> 
> Isn't there a risk that attribute templates become unreadable?

As said above, I don't think they are intended for complicated designs. 
I would use XSLT in such cases. My example above was chosen more for 
desscribing the mechanism than for being realistic.

Furthermore I forgot a paranthese in a place that was quite bad from a 
pedagogical POV. It should have been:

<p 
do="let(x=/a/long/path/from/the/root);if(x);content(x/txt);attributes(class=x/class)">
   Ex Text
</p>

I find it actually quite readable, but thats probably because I designed 
it ;) and also have spend a lot of time with functional programming 
languages (e.g. that in Mathematica). You can think of ';' as functional 
composition.

> snip...
> 
>>Connection to JXTG
>>------------------
>>
>>The directives are almoust defined in such a way that they could be
>>translated to a tag based templating language like:
>>
>>directive(param_1=value_1,...,param_n=value_n)
>>
>><=>
>>
>><jx:directive param_1="value_1" ... param_n="value_n"/>
>>
>>Maybe we could find a attribute directive language that allows for
>>complete correspondance. And make tag or directive syntax selectible and
>>in such way make this effort compatble with JXTG?
> 
> I like this idea very much. It would be a shame if the quirks of
> Dreamweaver should force everyone to use an awkward syntax.

The attribute driven synatax is new to me so I don't know if I find it 
awkward or not, I'll need to see some larger examples. Anyway, we have a 
user community (and our own webbaps) to think about, we cannot change 
dirrection at every whim. We must support JXTG for the forseable future 
so I would prefer if we could allow both syntaxes.

Now, it will be interesting to see how long time it will take before 
someone explains that: this is FS we only need to support one syntax, 
namely the obviously optimal one, and those who believe that they need 
the other one are generally less knowing and doesn't understand their 
own best ;)

/Daniel

Mime
View raw message