cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Peter Hunsberger" <>
Subject Re: Pattern for use of sub-pipelines to grab content at different stages?
Date Wed, 24 May 2006 13:56:32 GMT
On 5/24/06, Craeg Strong <> wrote:
> Hello:
> I want to assemble a web page the way a factory assembles a car.
> That is, I want to assemble a transmission, and set it aside (cache my
> header/footer)
> I want to assemble a chassis, and set it aside (cache my user-specific
> menu bar)
> Then I want to include the transmission, chassis, and frame into the
> final car (document).

One question; why do you want to do this?

> I think I can do the above with cocoon using cacheable sub-pipelines and
> xinclude, is that right?

Perhaps, you can definitely do it with aggregators if you don't mind
writing one final transform to glue everything together.

> All the examples I have seen to date that use xinclude and aggregators
> don't seem to support caching intermediate products.

Aggregators don't directly have anything to do with the cache, it's up
to the pipelines that feed the aggregators to manage what is

If you ask me it doesn't make sense to think about caching at the
level of page components.  Rather, you want to figure out your cache
concerns at the level of cache persistence.  Specifically; break down
what information persists forever, what changes per user, what changes
per session, what changes per page, etc.  Then you generate and cache
each of those so that each cache persists for the maximum amount of
time that makes sense for that type of content.

To manage the page assembly by component process you write XSLT that
breaks each area down as needed.  Eg, a transform for the header, a
transform for the header.  Each of these transforms can be reused
across multiple pages.  Each transform pulls data from any of the
aggregated cached pipeline content as needed.  That is, the header
might contain user specific info, and page specific info.

XML and XSLT psuedo code follows...

<page>            <!-- aggregator wrapper tag -->
    <layout>          <!-- content from page layout pipeline -->
    <userdata>        <!-- content from pipeline that caches at user level -->

<xsl:template match="/page">
   <xsl:applytemplates select="*"/>

<xsl:template match="layout">
   <xsl:applytemplates select="*"/>

<xsl:template match="header">
   <xsl:value-of select="/page/sessiondata/greeting"/>
   <xsl:value-of select="/page/userdata/name"/>

<xsl:template match="content">

<xsl:template match="footer">

Peter Hunsberger

View raw message