(this document is adapted from the message posted by stefanomazzocchi on the cocoon development mailing list)
Currently, people abuse the map:resource part of the sitemap to create pipeline fragments to call. This was introduced by the TreeProcessor implementation of the sitemap but map:resources were *not* designed to be pipeline fragments but entire pipelines.
It has been identified in several circumstances (but mostly dealing with blocks) that the need to use pipeline fragments is required.
I propose the creation of "virtual pipeline components" by aggregating two or more components into a virtual one. An example is
<map:components> <map:generators> <map:generator name="filteredFile"> <map:generator type="file"/> <map:transformer type="xslt" src="namespaceFilter.xsl"/> </map:generator> <map:transformers> <map:transformer type="skin"> <map:transformer type="xslt" src="fancy-doc2html.xslt"/> </map:transformer> </map:transformers> <map:serializers> <map:serializer type="html"> <map:transformer type="linkTranslator"/> <map:serializer type="html"/> </map:serializer> </map:serializers> </map:components>
As you can see from the example, with virtual components, we can:
- reuse pipeline fragments as they were one component.
- overload existing components with additional functionality
- specify the src of a general purpose component (for example, xslt) and reuse that particular instance as a component. (useful for precompilation of general purpose transformations or for reusing pipeline services implemented by blocks)
The virtual compoments can include any other sitemap component but:
- for generators, all but serializers
- for transformers, all but generators and serializers
- for serializers, all but generators
and, obviously, the order is important.