apache > cocoon
 

Augment Transformer

Augment Transformer

The AugmentTransformer augments all href attributes with the full path to the request. If a href is already a full HTTP URL, or HTTPS URL the value of href is not changed.

The AugmentTransformer has serveral configuration options. These options may be specified by each request.

  • mount: If this request parameter is specified it defines the URI relative to the servlet's context-path. If no mount parameter is specified the resolution is calculated relative to the request URI.
  • Name : augment
  • Class: org.apache.cocoon.transformation.AugmentTransformer
  • Cacheable: no.

A simple example might help to use the AugmentTransformer effectivly:

Add the AugmentTransformer to the components in your sitemap.xmap

...
<map:components>
...
  <map:transformers default="xslt">
  ...
    <map:transformer name="augment"
      src="org.apache.cocoon.transformation.AugmentTransformer">
    </map:transformer>
  ...

Next define in your pipeline to use the AugmentTransformer

<map:match pattern="**book-**.xml">
  <map:generate src="docs/{1}book.xml"/>
  <map:transform type="augment">
    <map:parameter name="mount" value="samples/flow/"/>
  </map:transform>
  ...

In the example above all href attributes which do not start with http, or https are augmented.

Assuming Cocoon is deployed at http://localhost:8080/cocoon a href href="overview.html" is augmented to href="http://localhost:8080/cocoon/samples/flow/overview.html".