cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Volkm@r" <plsdontre...@arcor.de>
Subject Re: Aggregation - or is it? How do I combine multiple streams of SAX events?
Date Thu, 03 Jun 2004 07:33:19 GMT
Jeff Jones wrote:
> I have a set of XSP/ESQL based pipelines that generate XML documents from an
> Oracle database. Essentially I'm using them as a sort of customized SQL/XML
> bridge, and I've been very happy with Cocoon for that purpose so far. (I'm using
> Cocoon 2.1.4 on Linux, but will upgrade to 2.1.5 at some point.)
> 
> Now I'd like to combine several of those individual XML documents into a single
> document. I know there are many possible approaches - map:aggregate, CInclude
> transformer, XInclude, taglibs, etc, etc. I've read through the online docs and
> the Cocoon Wiki, but I haven't found anything that makes sense yet.
> 
> What makes this more challenging are the following restrictions:
> 
> 1. There's not one static list of sub-documents to include - it's based on the
> request, with a mapping that changes fairly frequently, so I'd rather not put it
> in my sitemap if I can easily avoid it.

Mapping to frequently changing sources can be done using Cinclude.
 From sitemap.xmap you may call transformer with parameters from request 
like here:
=======================================================================
<map:match pattern="**.include">
   <map:generate src="logics/includes.xsl"/>
   <map:transform src="logics/includes.xsl">
     <map:parameter name="path" value="{1}"/>
   </map:transform>
   <map:transform type="cinclude"/>
   <map:serialize type="xml"/>
</map:match>
=======================================================================

And this is "includes.xsl" putting together pieces from pipeline along 
with pieces from changing source like
         <ci:include src="{$newpath}" select="..."/>
=======================================================================
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                 xmlns:ci="http://apache.org/cocoon/include/1.0">
   <xsl:param name="path"/>
   <xsl:variable name="newpath">
     <xsl:value-of select="$path"/>
     <xsl:if test="$path=''">index.html</xsl:if>
     <xsl:if test="substring($path, string-length($path), 1) = '/' ">
       index.html
     </xsl:if>
   </xsl:variable>
   <xsl:template match="/">
     <html>
       <head>
         <ci:include src="{$newpath}"
                     select="//*[local-name()='head']/*"/>
         <ci:include src="cocoon:/{$newpath}.navtoolbar"
                     select="links/*"/>
       </head>
       <body>
         <ci:include src="cocoon:/{$newpath}.linkmap"/>
         <div id="content">
           <ci:include src="{$newpath}"
                       select="//*[local-name()='body']/*"/>
         </div>
       </body>
     </html>
   </xsl:template>
</xsl:stylesheet>
=======================================================================

HTH
--
Volkmar  W.  Pogatzki


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


Mime
View raw message