You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Leo Sutic <le...@inspireinfrastructure.com> on 2001/04/30 11:22:48 UTC

[C2] Allowing actions to select transformer type

All,

I would like to be able to let the action that runs before the pipeline is
executed to select the type of transformer to be used:

  <map:pipeline>
   <map:match pattern="testpage.html">
    <map:act type="action">
     <map:generate type="testgenerator"/>
     <map:transform type="{transformer}" src="{stylesheet}"/>
     <map:serialize type="html"/>
    </map:act>
   </map:match>
  </map:pipeline>

Currently, substitution is only done for the src attribute of
<map:transform/>, and not for the type attribute, which causes Cocoon to
crash, as the transformer selector can't find a suitable transformer for the
hint "{transformer}".

I'm sure the same effect can be achieved via a selector that tests on
sitemap parameters, however: Since the substitution model is used for the
sitemap parameters set by actions everywhere else, it would be more
consistent to substitute the type attribute as well.

I'd like to hear some opinions about this before submitting a patch for
review. (Most of all, it would be nice to hear that this is already possible
in a much easier way than I know of. :-))

The possible patches I see are:

0) No patch, this is already possible.
1) Change lines 1197, 1213, 1218 of
xml-cocoon/src/org/apache/cocoon/components/language/markup/sitemap/java/sit
emap.xsl. This is the way I'd like to do it.
2) Create a new selector that tests on sitemap parameters.

/LS


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


RE: [C2] Allowing actions to select transformer type

Posted by giacomo <gi...@apache.org>.

On Tue, 1 May 2001, Leo Sutic wrote:

> All,
>
> if Sylvain is correct, and there are caching issues associated with this,
> the change could potentially break Cocoon. (I believe he's right - if the
> pipelines change depending on their content, caching may be difficult. But I
> haven't really thought this through.)
>
> After reading the posts by Giacomo and Sylvain, I'm -1 on substitution in
> type attributes as well.
>
> However, if I modify my suggestion to the 3rd possible patch I described in
> my original email:
>
> > > 2) Create a new selector that tests on sitemap parameters.

Ever looked at the CodedSelectorFactory? It could save your problems.

Giacomo

> As I will only have to choose between 2 or max 3 different transformers (all
> of which are known in advance), this will solve my problem. Would this merge
> better with Cocoon?
>
> I figure it'd be something like:
>
> <map:selector name="parameter" parametertoexamine="myparameter"
> factory="org.apache.cocoon.selection.ParameterSelectorFactory"/>
>
> ...
>
> <map:select type="parameter">
>  <map:when test="myvalue">
>   ...
>  </map:when>
>  <map:when test="myothervalue">
>   ...
>  </map:when>
> </map:select>
>
> /LS
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> For additional commands, email: cocoon-dev-help@xml.apache.org
>
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


RE: [C2] Allowing actions to select transformer type

Posted by Leo Sutic <le...@inspireinfrastructure.com>.
All,

if Sylvain is correct, and there are caching issues associated with this,
the change could potentially break Cocoon. (I believe he's right - if the
pipelines change depending on their content, caching may be difficult. But I
haven't really thought this through.)

After reading the posts by Giacomo and Sylvain, I'm -1 on substitution in
type attributes as well.

However, if I modify my suggestion to the 3rd possible patch I described in
my original email:

> > 2) Create a new selector that tests on sitemap parameters.

As I will only have to choose between 2 or max 3 different transformers (all
of which are known in advance), this will solve my problem. Would this merge
better with Cocoon?

I figure it'd be something like:

<map:selector name="parameter" parametertoexamine="myparameter"
factory="org.apache.cocoon.selection.ParameterSelectorFactory"/>

...

<map:select type="parameter">
 <map:when test="myvalue">
  ...
 </map:when>
 <map:when test="myothervalue">
  ...
 </map:when>
</map:select>

/LS


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Re: [C2] Allowing actions to select transformer type

Posted by giacomo <gi...@apache.org>.

On Mon, 30 Apr 2001, Leo Sutic wrote:

> All,
>
> I would like to be able to let the action that runs before the pipeline is
> executed to select the type of transformer to be used:
>
>   <map:pipeline>
>    <map:match pattern="testpage.html">
>     <map:act type="action">
>      <map:generate type="testgenerator"/>
>      <map:transform type="{transformer}" src="{stylesheet}"/>
>      <map:serialize type="html"/>
>     </map:act>
>    </map:match>
>   </map:pipeline>
>
> Currently, substitution is only done for the src attribute of
> <map:transform/>, and not for the type attribute, which causes Cocoon to
> crash, as the transformer selector can't find a suitable transformer for the
> hint "{transformer}".

True.

> I'm sure the same effect can be achieved via a selector that tests on
> sitemap parameters, however: Since the substitution model is used for the
> sitemap parameters set by actions everywhere else, it would be more
> consistent to substitute the type attribute as well.

Carefull! While one could argument it would be consistent syntactically
I say it doesn't make sense semantically. The type attribute is meant as
an idref for a component not a resource or an arbitrary value.

Of course it is Cocoons job to select from thousands of resources in one
pipeline but it smells like FS (Flexibility Syndrom) to select among a
few component only because it is doable.

I see this as a hidden Reactor Pattern which has proven to be dangerous
because it forces distribution of control, which creates too many
contracts between the different contexts. Result: increase of management
costs.

I still like the old pyramid model of site management. It forces a
better separation between the working contexts (content, style and
logic) and the management context.

And for those reasons I'm -1 on substitution in type attributes

Giacomo

> I'd like to hear some opinions about this before submitting a patch for
> review. (Most of all, it would be nice to hear that this is already possible
> in a much easier way than I know of. :-))
>
> The possible patches I see are:
>
> 0) No patch, this is already possible.
> 1) Change lines 1197, 1213, 1218 of
> xml-cocoon/src/org/apache/cocoon/components/language/markup/sitemap/java/sit
> emap.xsl. This is the way I'd like to do it.
> 2) Create a new selector that tests on sitemap parameters.
>
> /LS
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> For additional commands, email: cocoon-dev-help@xml.apache.org
>
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Re: [C2] Allowing actions to select transformer type

Posted by Sylvain Wallez <sy...@anyware-tech.com>.

Donald Ball a écrit :
> 
> On Mon, 30 Apr 2001, Leo Sutic wrote:
> 
> > I would like to be able to let the action that runs before the pipeline is
> > executed to select the type of transformer to be used:
> >
> >   <map:pipeline>
> >    <map:match pattern="testpage.html">
> >     <map:act type="action">
> >      <map:generate type="testgenerator"/>
> >      <map:transform type="{transformer}" src="{stylesheet}"/>
> >      <map:serialize type="html"/>
> >     </map:act>
> >    </map:match>
> >   </map:pipeline>
> >
> > Currently, substitution is only done for the src attribute of
> > <map:transform/>, and not for the type attribute, which causes Cocoon to
> > crash, as the transformer selector can't find a suitable transformer for the
> > hint "{transformer}".
> >
> > I'm sure the same effect can be achieved via a selector that tests on
> > sitemap parameters, however: Since the substitution model is used for the
> > sitemap parameters set by actions everywhere else, it would be more
> > consistent to substitute the type attribute as well.
> 
> i think i'd be +1 for the change. general question - is there a compelling
> reason not to do {} substitution for all sitemap attributes?
> 
> - donald
> 
Aren't there any cache issues if the actual transformer used is not
predefined in the sitemap ?

-- 
Sylvain Wallez
Anyware Technologies - http://www.anyware-tech.com

---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Re: [C2] Allowing actions to select transformer type

Posted by giacomo <gi...@apache.org>.

On Mon, 30 Apr 2001, Donald Ball wrote:

> On Mon, 30 Apr 2001, Leo Sutic wrote:
>
> > I would like to be able to let the action that runs before the pipeline is
> > executed to select the type of transformer to be used:
> >
> >   <map:pipeline>
> >    <map:match pattern="testpage.html">
> >     <map:act type="action">
> >      <map:generate type="testgenerator"/>
> >      <map:transform type="{transformer}" src="{stylesheet}"/>
> >      <map:serialize type="html"/>
> >     </map:act>
> >    </map:match>
> >   </map:pipeline>
> >
> > Currently, substitution is only done for the src attribute of
> > <map:transform/>, and not for the type attribute, which causes Cocoon to
> > crash, as the transformer selector can't find a suitable transformer for the
> > hint "{transformer}".
> >
> > I'm sure the same effect can be achieved via a selector that tests on
> > sitemap parameters, however: Since the substitution model is used for the
> > sitemap parameters set by actions everywhere else, it would be more
> > consistent to substitute the type attribute as well.
>
> i think i'd be +1 for the change. general question - is there a compelling
> reason not to do {} substitution for all sitemap attributes?

Yes, I think it is. Read my response to this mail.

Giacomo


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Re: [C2] Allowing actions to select transformer type

Posted by Donald Ball <ba...@webslingerZ.com>.
On Mon, 30 Apr 2001, Leo Sutic wrote:

> I would like to be able to let the action that runs before the pipeline is
> executed to select the type of transformer to be used:
>
>   <map:pipeline>
>    <map:match pattern="testpage.html">
>     <map:act type="action">
>      <map:generate type="testgenerator"/>
>      <map:transform type="{transformer}" src="{stylesheet}"/>
>      <map:serialize type="html"/>
>     </map:act>
>    </map:match>
>   </map:pipeline>
>
> Currently, substitution is only done for the src attribute of
> <map:transform/>, and not for the type attribute, which causes Cocoon to
> crash, as the transformer selector can't find a suitable transformer for the
> hint "{transformer}".
>
> I'm sure the same effect can be achieved via a selector that tests on
> sitemap parameters, however: Since the substitution model is used for the
> sitemap parameters set by actions everywhere else, it would be more
> consistent to substitute the type attribute as well.

i think i'd be +1 for the change. general question - is there a compelling
reason not to do {} substitution for all sitemap attributes?

- donald


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org