On 5/24/06, Craeg Strong <[EMAIL PROTECTED]> 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
cacheable.

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 -->
      <header/>
      <content/>
     <footer/>
  </layout>
   <userdata>        <!-- content from pipeline that caches at user level -->
     <name>...</name>
      ...
   </iuserdatal>
   <sessiondata>
     <greeting>..</greeting>
      ...
   </sessiondata>
 ...
</page>

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

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

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

<xsl:template match="content">
  whatever
</xsl:tempalte>

<xsl:template match="footer">
  whatever
</xsl:tempalte>

--
Peter Hunsberger

Reply via email to