cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marcus Crafter <craft...@dresdnerbank.de>
Subject [C2 & patch] Re: Matchers and Selectors (was Re: Better and Better and RT)
Date Sat, 11 Nov 2000 17:19:34 GMT
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).

	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:

	<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).

	This means the 2 variables can have the same name (eg. if you use <
	or > in 2 equal leveled when statements).
	
	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've attached a patch with the changes.
	
	I'll send in the selector as soon as I have something up and working.

> I hope my examples will help you understand the generality of those
> components :)

	Sure have. Thanks :-)

	Cheers,

	M.

-- 
        .....
     ,,$$$$$$$$$,      Marcus Crafter
    ;$'      '$$$$:    Computer Systems Engineer
    $:         $$$$:   Open Software Associates GmbH
     $       o_)$$$:   82-84 Mainzer Landstrasse
     ;$,    _/\ &&:'   60327 Frankfurt Germany
       '     /( &&&
           \_&&&&'     Email : Marcus.Crafter@osa.de
          &&&&.        Business Hours : +49 69 9757 200
    &&&&&&&:           After Hours    : +49 69 49086750


Mime
View raw message