On 6/25/06, Jörn Nettingsmeier <[EMAIL PROTECTED]> wrote:
I have the following two modules:
"xmldb", a module to query an exist xml database. in its sitemap it
contains a resource "xmldb", which is a complex chain of transformers:
   <map:resource name="xmldb">
     <!-- expand any jx parameter references in the query -->
     <map:transform type="jx"/>
     <!-- transform xq:query element into cinclude xmldb query -->
     <map:transform type="xslt" src="xslt/xmldb-preprocessing.xsl"/>
     <!-- perform the query by sending a POST request
          to the xmldb query handler -->
     <map:transform type="cinclude">
       <map:parameter name="support-caching" value="false"/>
     </map:transform>
     <!-- clean up result from the xqueryhandler -->
     <map:transform type="xslt" src="xslt/xmldb-postprocessing.xsl"/>
   </map:resource>

"people", a module that generates staff pages by querying said database.
in the "people" sitemap, i want to re-use that resource to keep things
modular:

<map:generate src="queryPerson.xml"/>
<map:call resource="cocoon://modules/xmldb/xmldb"/>
<map:transform type="xslt" src="xslt/person2html.xsl"/>
<map:serialize type="xml"/>

of course the map:call does not work, because resources have to be local.
how can i accomplish this? iiuc i cannot use an entire pipeline with
map:mount, because the generation must happen in the "people" sitemap,
(the people module contains the query file).

i could think of having a callback-style pipeline in "xmldb" that gets
passed a src parameter of the form
"cocoon://modules/people/queryPerson.xml", but i would like to avoid it
because it seems unidiomatic and rather complicated.

I think you understand the issue.  You need to change both modules to
make it work.  Make your "callback" pipeline generic so it works with
any module.

See Lenya1.3's "live" and "cache" Modules for an example.
- The "live" Module constructs a special match.   If the "cache"
Module is used in the Publication, "live" uses map:mount to pass
control to the cache Module.  (It also checks for a "homepage" Module,
but that is a direct transfer of control.)
- The "cache" Module decides if caching is warranted, and checks if
the page is in the cache.  If the page needs to be generated, it uses
map:generate to get the results of a pipeline in the calling Module.

NOTE: There is a bug in map:read so it cannot be used in a pipeline
called with map:generate.  This was apparently deliberate poor
programming design in Cocoon.  That is why "live" needed to use
map:mount to pass to "cache".  Without this bug, map:generate could
have been used for much simpler code.  You may be able to pass control
between the Modules without map:mount.

solprovider

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to