Main

March 31, 2006

Random Cocoon practice: use <map:call resource>

Use <map:call resource="some-pipeline" /> to avoid duplication of pipeline constructions in your sitemap.

Define a resource as follows in the <map:resources> part of your sitemap :

<map:resource name="post-process-and-serialize">
   <map:transform src="transformers/libs/util/stripnamespaces.xsl" />
   <map:transform type="linkrewriter" />
   <map:serialize type="html" />
</map:resource>

Call this resource from your pipeline:

<map:match pattern="*/index.html">
   <map:generate src="some.xml"/>
   <map:transform src="transformers/some.xsl">
   <map:call resource="post-process-and-serialize"/>
</map:match>

Is it possible to pass parameters to map:call resource?
--> Yes, simply use <map:parameter> statements

Thanks to Jeremy Quinn for this insight!
Also see http://wiki.apache.org/cocoon/CleanerSiteMapsThroughResources