cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Geoff Howard <coc...@leverageweb.com>
Subject Re: Wildchar URI matchers inclusive or exclusive?
Date Mon, 13 Oct 2003 18:39:45 GMT
Olivier Lange wrote:

> Hello all,
> 
> Is it true that nested wildchar URI matchers are "inclusive" and trigger on
> _all_ matches, while the top level matchers are "exclusive" and trigger on
> _first match_ only?
> 
> I noticed that Cocoon 2.1 behaves like that and could not confirm it from
> the documentation.
> 
> For instance, with the following sitemap fragment:
> 
>   <map:pipeline>
>     <!-- Top level matcher -->
>     <map:match pattern="*/events/**.html">
> 
>       <!-- Nested matcher 1 -->
>       <map:match pattern="*/events/index.html">
>         <map:generate src="cocoon:/xpg/{1}/even-home"/>
>       </map:match>
> 
>       <!-- Nested matcher 2 -->
>       <map:match pattern="*/events/*.html">
>         <map:generate src="cocoon:/xpg/{1}/even-{2}"/>
>       </map:match>
> 
>       <!-- Transformation + serialization -->
>       <map:call resource="xpg-xhtml"/>
>     </map:match>
>   </map:pipeline>
> 
> If I request URI fr/events/index.html, both nested matchers 1 + 2 will
> trigger, resulting in a "Generator already set. You can only select one
> Generator" message.

Hmm.  I think this is a matter of complete vs. incomplete pipelines not 
different behavior between top-level and nested matchers.  Try the 
following:

<map:pipeline>
     <!-- Toplevel matcher 1 -->
     <map:match pattern="*/events/index.html">
       <map:generate src="cocoon:/xpg/{1}/even-home"/>
     </map:match>

     <!-- Toplevel matcher 2 -->
     <map:match pattern="*/events/*.html">
        <map:generate src="cocoon:/xpg/{1}/even-{2}"/>
     </map:match>

     <!-- Transformation + serialization -->
     <map:call resource="xpg-xhtml"/>
</map:pipeline>

If that does any differently then we'll need to take a closer look.

> Now, if the sitemap is written as:
> 
>   <map:pipeline>
>     <!-- Top level matcher 1 -->
>     <map:match pattern="*/events/index.html">
>         <map:generate src="cocoon:/xpg/{1}/even-home"/>
>         <map:call resource="xpg-xhtml"/>
>     </map:match>
> 
>     <!-- Top level matcher 2 -->
>     <map:match pattern="*/events/*.html">
>       <map:generate src="cocoon:/xpg/{1}/even-{2}"/>
>       <map:call resource="xpg-xhtml"/>
>     </map:match>
>   </map:pipeline>
> 
> and if I request the URI fr/events/index.html, then only the first matcher
> will trigger.
> 
> I believe this is the intended behavior, but could someone confirm it?

This is what I would expect too.  Someone with more history on the 
design of the sitemap semantics will need to confirm though.  I think 
that by design the sitemap keeps examining matchers, selectors, and 
actions until it finds a complete pipeline or an error caused by too 
many or too few components with no other paths to follow.

> In case it is, I suggest adding a note at least here for this subtle
> behaviorial change (I would submit a patch):
> http://cocoon.apache.org/2.1/userdocs/matchers/matchers.html#Order

Patch welcome - submit it to Bugzilla with [PATCH] as the beginning of 
the summary.  If the patch is simple, just do one and we can confirm 
accuracy on the dev list when the automatic notice arrives.  If it's 
longer and you'd rather get a definitive answer first, forward this to 
the dev list with perhaps a modified subject.

Geoff


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


Mime
View raw message