A "resource" is a subroutine to prevent repeating code. Add the
resource to the "resources" section. The "map:resources" element is a
child of "map:sitemap". The typical order is zero or one each of
"map:components", "map:views", "map:resources", then one or more
"map:pipelines".
<map:resources>
<map:resource name="log-to-file">
<map:transform
src="fallback://lenya/xslt/authoring/edit/addSourceTags.xsl">
<map:parameter name="source"
value="context://lenya/pubs/debug/{fileprefix}-{filedatetime:currentDate}.xml"/>
</map:transform>
<map:transform type="write-source">
<map:parameter name="serializer" value="xml"/>
</map:transform>
<map:transform
src="fallback://lenya/xslt/authoring/edit/removeSourceTags.xsl"/>
</map:resource>
</map:resources>
In the pipeline, you use:
<!-- DEV DEBUG 1 BEGIN -->
<map:call resource="log-to-file"><map:parameter name="fileprefix"
value="AfterTransform1"/></map:call>
<!-- DEV DEBUG 1 END -->
XML does not care if the elements are on one line or multiple lines.
I condensed the "function call" to one line, but you can indent the
three elements on as many lines as you want.
solprovider
On 10/12/08, Florent André <[EMAIL PROTECTED]> wrote:
> In the XMAP that I want to debug, I have to write (copy-past in reality)
> this at each debug point :
> <!-- /////debugging 2////// -->
>
> <map:transform
> src="fallback://lenya/xslt/authoring/edit/addSourceTags.xsl">
> <map:parameter name="source"
>
> value="context://lenya/pubs/debug/AfterIncludeSubNews-{filedatetime:currentDate}.xml"/>
>
> </map:transform>
> <map:transform type="write-source">
> <map:parameter name="serializer" value="xml"/>
> </map:transform>
> <map:transform
> src="fallback://lenya/xslt/authoring/edit/removeSourceTags.xsl"/>
>
> <!-- debugging -->
>
> This 9 lines are not very "sexy", and if many debug point are define, the
> reading of the xmap is less easy...
>
> So,
> It's possible to define a "super transformer" that groups this 3
> transformers ? (All tranformers that I see are define with a java class,
> but not with sub-tranformation...)