Hi Sven!

On Dec 7, 2006, at 2:46 PM, sven goosen wrote:

What I want to have, is that every *.jx page will be aggregated with my menu.xml.

RIght! :-)

But how can I do this. I can't put an <map:aggregate> in my *.jx match. because the <map:generate> is already there.

Yeah, it doesn't make any sense to put an aggregator after a generator, does it?

Like I told somebody else a while back, "Think pull, not push". When you think about the matcher that's going to match a request, don't think first about how where the data stream starts, instead think about the end of the pipeline, because that's how your matcher has to end (or with a redirect), then work backwards.

Here's what I always do... something like this:

  <match pattern="**">  <!-- Everything!!!! -->
    <call resource="page.html">
      <parameter name="page" value="{0}"/>
    </call>
  </match>

  <resource name="page.html">
    <aggregate element="page">

      <!-- Here's the "pull"... match this to get main
              content source for the page -->
      <part element="source" src="cocoon:/{page}.source" />
        
      <part element="nav" src="whatever" />
      <!-- etc... -->
    </aggregate>
    <transform src="context:/xslt/site/page.xslt"/>  <!-- whatever-->
    <serialize type="html"/>
  </resource>

Now, you can have any number of matchers to provide content source in a variety of ways, e.g.

   <!-- client requested "foo"; flow handles this one... -->
   <match pattern="foo.source">
       <call function="foo"/>
   </match>

   <!-- continuations -->
   <match pattern="**.continue.source">
        <call continuation="{1}"/>
   </match>

   <!-- everything else: just regular xhtml -->
   <match pattern="**.source">
       <generate src="context:/content/{1}.xml"/>
       <serialize type="xml"/>
   </match>


Cheers and HTH,
—ml—

PS — I actually like use ":source" instead of ".source", but that doesn't work without a patch. Cocoon is broken and throws an exception if you try to use a colon inside the context-path part of a URI. The patch hasn't been accepted into Cocoon yet though... :-/

Reply via email to