Augment Transformer
http://xml.apache.org/http://www.apache.org/http://www.w3.org/

Main
User Documentation

Transformers
Overview

Default
XSLT Transformer

Core
Fragment Extractor Transformer
I18n Transformer
Log Transformer
SQL Transformer
Filter Transformer
Read DOM Session Transformer
Write DOM Session Transformer
XInclude Transformer
CInclude Transformer
EncodeURL Transformer
SourceWriting Transformer
Augment Transformer
Text Parser Transformer

Optional
XT Transformer
LDAP 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".

Copyright © 1999-2002 The Apache Software Foundation. All Rights Reserved.