Return-Path: Delivered-To: apmail-cocoon-dev-archive@www.apache.org Received: (qmail 6636 invoked from network); 7 Dec 2004 01:40:21 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 7 Dec 2004 01:40:21 -0000 Received: (qmail 61537 invoked by uid 500); 7 Dec 2004 01:40:19 -0000 Delivered-To: apmail-cocoon-dev-archive@cocoon.apache.org Received: (qmail 61275 invoked by uid 500); 7 Dec 2004 01:40:17 -0000 Mailing-List: contact dev-help@cocoon.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Reply-To: dev@cocoon.apache.org Delivered-To: mailing list dev@cocoon.apache.org Received: (qmail 61260 invoked by uid 99); 7 Dec 2004 01:40:17 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: local policy) Received: from mout.perfora.net (HELO mout.perfora.net) (217.160.230.41) by apache.org (qpsmtpd/0.28) with ESMTP; Mon, 06 Dec 2004 17:40:16 -0800 Received: from minotaur.apache.org[209.237.227.194] (helo=[127.0.0.1]) by mrelay.perfora.net with ESMTP (Nemesis), id 0MKyxe-1CbUKr2dIP-0004Ci; Mon, 06 Dec 2004 20:40:13 -0500 X-Provags-ID: perfora.net abuse@perfora.net login:e2e4156964dfbcc4c642ec658fa7f9b9 Message-ID: <41B509FB.8070408@reverycodes.com> Date: Mon, 06 Dec 2004 20:40:11 -0500 From: Vadim Gritsenko User-Agent: Mozilla Thunderbird 0.9 (Windows/20041103) X-Accept-Language: en-us, en MIME-Version: 1.0 To: dev@cocoon.apache.org Subject: Re: [RT] Attribute Driven Templates (Was: [RT] do me a favor, don't call them taglibs) References: <41B0D196.5080707@apache.org> <41B1B208.2080809@nada.kth.se> In-Reply-To: <41B1B208.2080809@nada.kth.se> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Daniel Fagerstrom wrote: > Just a reminder; before you guys start implementing one or another template language, could we have [VOTE] for one of the variants, have [PROPOSAL], or at least [SUMMARY]? :) Here, I just want to comment that I find way more intuitive and user friendly following constructs: > if() > ---------- > > example: > >
and
for conditions. > Your cart is empty >
> > > forEach() > ------------------- > > example: > > > or for iterators. > > > > >
${index}${description}${price}
> > > for(var=,begin=,end=,step=) > --------------------------------------------------- Is it necessary? Current jxtg does not have it (IIRC). > context= > -------------- > > Set the current evaluation context for expressions. > > example: > >
or t:context, or some such. ... and the rest is similar. I also feel that expressions like "if();context();let();for();etc;etc;etc" are too complicated for what is necessary in Cocoon Templates. Vadim > ... >
> > > let(=,...,=) > ------------------------------------ > > Define a number of variables for the current context. Observe that this > not is a set operation it just defines the content of the variable > $ in the current context, it doesn't intoduce any possibilities to > have side effects. > > example: > >

> > ${item} > > > > We also need an evalBody as in JXTG. And maybe we should have a > possibilty to give a name space to the macro name. > > > eval(,context=,=,...,=) > ----------------------------------------------------------------------- > > Evaluates the named macro in either the curent context or the > excplictliy chosen, with a number of forma parameters. The containing > element is replaced by the result of the evaluation. And the content of > the the containing element is available in the macro through "evalBody". > > example: > > > > We could maybe even have the synatax: > >
> > for user defined macros. > > > replace() > --------------- > > Replaces the containing element with the result of the expression, > useful for inserting DOM etc from the flow layer. > > example: > >
> > > content() > --------------- > > Like replace but replaces only the content. > > > attributes(=,...,=) > ------------------------------------------- > > Inserts an attribute. > > > Several directives > ------------------ > > So, how do we handle multiple directives for one element? We could > handle the TAL example above like: > >

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

> > The idea is that when the leftmost directive is executed it has the > ability to access the result of executing the directive sequence right > of it in its current context. It will be the rightmost directive that > has direct access to the containing element with evaluated attributes > and body. > > The corresponding tag based template expression would be (in pseudo jx): > > > > > >

Ex Text

>
>
>
> > > The jx:attribute and jx:content returns the patched variant of its > respectively body. Not particulary natural constructions in a tag based > template language, but hopefully it explains the direcive combination > construction.