HOME | NEWS | FAQ | DOCUMENTATION | DOWNLOADS | SITE MAP | CONTACTS/LINKS

LogTransformer

The Log Transformer allows fragments of XML to be written to an external file to aid in debugging sitemap pipelines. A typical use of LogTransformer would be

<map:transformers default="xslt"> <map:transformer name="log" src="resource://lib/transforming/LogTransformer"/> ... </map:transformers> <map:pipelines> <map:pipeline> <map:match pattern="**.html"> ... <map:transform type="log"> <map:parameter name="logfile" value="context://logs/logfile-aggr.log"/> <map:parameter name="append" value="yes"/> <map:parameter name="filter" value="//*[local-name() = 'p'][2]"/> </map:transform> ... </map:match> </map:pipeline> </map:pipelines>

where

  • logfile — defines the logfile to use (must have correct permissions set).
  • append — defines whether the log data is appended to the end of the file (yes) or a new file is created each time (no).
  • filter — provides a means to restrict what is output to the log file using an XPath expression. For example, the example above would just output the second paragraph ( <p> ) of the XML in the pipeline at that point. Note that the expression should be "namespace-neutral", that is, only local names should be used.

The example above might give the following (from the documentation home page):

============================================================================== <t:p>Installation is very simple &#x2014; just follow the (brief) instructions <link:link type="uri" ref="install.html">here</link:link>.</t:p>
 
left footerCopyright 2006 – 2007 Hugh Field-Richards. All Rights Reserved.