In order to bring all templates together you can use the PatchworkGenerator. This generator reads the master template and places recursively all sub templates at the positions of the includes, specified in the patchwork config. To use the PatchworkGenerator you have to add it in the components section of your sitemap first:
<map:generator name="patchwork" src="com.logabit.webtools.patchwork.generation.PatchworkGenerator"/>
After you added the PatchworkGenerator to your components section of your sitemap, you can use it in your pipeline. The simplest way to do so is shown in the example below:
<map:match pattern="news"> <map:generate type="patchwork"/> <map:serialize type="html"/> </map:match>
Using the PatchworkGenerator without any parameter tells the Patchwork manager to use the current sitemap uri in order to search for a layout with the same name and then to load that layout. In the example above this would be the name news.
In some cases one wouldn't use the sitemap uri to match the name of the layout. In this case you could use the parameter call-layout to tell the PatchworkGenerator which layout should be loaded. This is extremely usefuly if you're using wildcards for example:
<map:match pattern="*.do">
<map:generate type="patchwork">
<map:parameter name="call-layout" value="{1}"/>
</map:generate>
<map:serialize type="html"/>
</map:match>
In this case the parameter call-layout is used to pass the name of the layout which should be loaded explicitely to the generator.
You can also use the parameter request-name to overwrite the name of the request attribute for the Patchwork object as defined for the Patchwork manager configuration in cocoon.xconf.