cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Giacomo Pati <giac...@apache.org>
Subject Re: [C2 & patch] Re: Matchers and Selectors (was Re: Better and Betterand RT)
Date Sun, 12 Nov 2000 17:02:43 GMT
Marcus Crafter wrote:
> 
> On Thu, 9 Nov 2000, Giacomo Pati wrote:
> 
> > The concept of a Matcher is much more general. You can easily write a
> > Matcher that matches "high load on the servel" or alike.
> 
>         *nod*.. sounds good.
> 
> > How about his:
> >
> >    <select type="paramselector">
> >      <when test="myparameter = on">
> >        ...
> >      </when>
> >      <when test="yourparameter = on">
> >        ...
> >      </when>
> >      <otherwise>
> >        ...
> >      </otherwise>
> >    </select>
> 
>         Excellent idea. I'm putting it together at the moment. Note for the
>         above example to work, we'll need to add = to the call to 'translate' in
>         sitemap.xsl (when 'generate-name' is called, otherwise the = sign is
>         added to the generated class variable name causing a compiler error).

Oh, yes of course, I didn't think of. Maybe it's better to get rid of
trying to derivate names from the pattern and generate pure names with
generate-id().

>         I also though about implementing 'greater than' and 'less than'
>         operators too. Over time I would like to expand the set of operators
>         to include many varied tests. ie:

Why not. But keep in mind your operators are used by admin people not by
programmers (and with admin people i don't meant sys admins :). So
please keep it as simple and understandable as possible.

You can use an "is" instead of "=" (good old COBOL is comming back :])

>         <when test="yourparameter > 30">
>                 ...
>         </when>
> 
>         However there is a problem in sitemap.xsl here. The translate method
>         can turn the < and > symbols into _ symbols which is fine, but the
>         call to 'generate-id()' will give the same id for both generated class
>         variables (because generate-id() is called with .. as a parameter).

Yes, see above.

>         This means the 2 variables can have the same name (eg. if you use <
>         or > in 2 equal leveled when statements).

Yup.

>         I've changed the call to generate-id() to use . (ie. the current node,
>         instead of its parent) to fix this problem - why was it
>         using .. anyway ? Have I possible broken something else ?

I wanted to have the same id based on the <select> element and not on
the <when> or <otherwise>. But yes, anyway, I'll have to change the hole
name generation stuff.

>         I've attached a patch with the changes.

Thanks, it's a workaround for now.

Giacomo

Mime
View raw message