blob: 31ac41c56a1431f64076c969bb9e1535001c0391 [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.0//EN" "../../dtd/document-v10.dtd">
<document>
<header>
<title>Augment Transformer</title>
<subtitle>in @doctitle@</subtitle>
<version>0.9</version>
<type>Technical document</type>
<authors>
<person name="Bernhard Huber" email="huber@apache.org"/>
</authors>
<abstract>This document describes the Augment transformer.</abstract>
</header>
<body>
<s1 title="Augment Transformer">
<p>
The AugmentTransformer
augments all <code>href</code> attributes with the full path to the request.
If a <code>href</code> is already a full HTTP URL, or HTTPS URL the value of
href is not changed.
</p>
<p>
The AugmentTransformer has serveral configuration options. These options
may be specified by each request.
</p>
<dl>
<dt>mount</dt>
<dd>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.
</dd>
</dl>
<ul>
<li>Name : augment</li>
<li>Class: org.apache.cocoon.transformation.AugmentTransformer</li>
<li>Cacheable: no.</li>
</ul>
<p>
A simple example might help to use the AugmentTransformer effectivly:
</p>
<p>
Add the AugmentTransformer to the components in your sitemap.xmap
</p>
<source><![CDATA[
...
<map:components>
...
<map:transformers default="xslt">
...
<map:transformer name="augment"
src="org.apache.cocoon.transformation.AugmentTransformer">
</map:transformer>
...
]]></source>
<p>
Next define in your pipeline to use the AugmentTransformer
</p>
<source><![CDATA[
<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>
...
]]></source>
<p>
In the example above all href attributes which do not start with <code>http</code>, or
<code>https</code> are augmented.
</p>
<p>
Assuming Cocoon is deployed at <code>http://localhost:8080/cocoon</code> a
href <code>href="overview.html"</code> is augmented
to <code>href="http://localhost:8080/cocoon/samples/flow/overview.html"</code>.
</p>
</s1>
</body>
</document>