Transformers
Transformers take the pipeline data as a DOM document, transform it into another DOM and output back into the pipeline. There can be as many
transformer as taste and performance will allow (I think that the maximum I ever had in a Cocoon pipeline was 12, and all of
them necessary — honest).
Component Declarations
Transformers are defined in the component declaration part of the Sitemap. For example
<map:transformers default="xslt">
<map:transformer name="xslt" src="resource://lib/transforming/TRAXTransformer">
<map:use-request-parameters>true</map:use-request-parameters>
</map:transformer>
<map:transformer name="pageHit" src="resource://lib/transforming/PageHitTransformer">
<map:parameter name="file" value="context://logs/PageHit.cnt"/>
<map:parameter name="unique" value="false"/>
<map:parameter name="cookie-name" value="PalooseTextHit"/>
<map:parameter name="ignore" value="127.0.0.1"/>
</map:transformer>
<map:transformer name="i18n" src="resource://lib/transforming/I18nTransformer">
<map:catalogues default="index">
<map:catalogue id="index" name="index" location="context://content/translations"/>
</map:catalogues>
<map:untranslated-text>untranslated text</map:untranslated-text>
</map:transformer>
<map:transformer name="gallery" src="resource://lib/transforming/GalleryTransformer">
<map:parameter name="root" value="context://gallery/"/>
<map:parameter name="image-cache" value="context://resources/images/cache/"/>
<map:parameter name="max-thumbnail-width" value="150"/>
<map:parameter name="max-thumbnail-height" value="150"/>
<map:parameter name="resize" value="1"/>
<map:parameter name="max-width" value="600"/>
<map:parameter name="max-height" value="600"/>
</map:transformer>
<map:transformer name="log" src="resource://lib/transforming/LogTransformer"/>
<map:transformer name="xinclude" src="resource://lib/transforming/XIncludeTransformer"/>
<map:transformer name="password" src="resource://lib/transforming/PasswordTransformer"/>
<map:transformer name="write-source" src="resource://lib/transforming/SourceWritingTransformer" />
</map:transformers>
The default attribute specifies the type of serializer to use if none is specified in a pipeline.
Copyright 2006 – 2024 Hugh Field-Richards. All Rights Reserved.