huber 2002/06/30 03:48:12
Modified: src/documentation/xdocs/userdocs/transformers
transformers.xml book.xml
Added: src/documentation/xdocs/userdocs/transformers
encodeurl-transformer.xml
Log:
Add documentation of EncodeURLTransformer, as it moved from scratchpad
Revision Changes Path
1.3 +1 -0
xml-cocoon2/src/documentation/xdocs/userdocs/transformers/transformers.xml
Index: transformers.xml
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/documentation/xdocs/userdocs/transformers/transformers.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- transformers.xml 30 May 2002 17:49:00 -0000 1.2
+++ transformers.xml 30 Jun 2002 10:48:12 -0000 1.3
@@ -39,6 +39,7 @@
<li><link
href="writedomsession-transformer.html">Write DOM Session Transformer</link></li>
<li><link href="xinclude-transformer.html">XInclude
Transformer</link></li>
<li><link href="cinclude-transformer.html">CInclude
Transformer</link></li>
+ <li><link href="encodeurl-transformer.html">EncodeURL
Transformer</link></li>
<li><link href="xt-transformer.html">XT
Transformer</link> (optional)</li>
<li><link href="ldap-transformer.html">LDAP
Transformer</link> (optional)</li>
</ul>
1.2 +1 -0
xml-cocoon2/src/documentation/xdocs/userdocs/transformers/book.xml
Index: book.xml
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/documentation/xdocs/userdocs/transformers/book.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- book.xml 3 Jan 2002 12:31:06 -0000 1.1
+++ book.xml 30 Jun 2002 10:48:12 -0000 1.2
@@ -26,6 +26,7 @@
<menu-item label="Write DOM Session Transformer"
href="writedomsession-transformer.html"/>
<menu-item label="XInclude Transformer" href="xinclude-transformer.html"/>
<menu-item label="CInclude Transformer" href="cinclude-transformer.html"/>
+ <menu-item label="EncodeURL Transformer" href="encodeurl-transformer.html"/>
</menu>
<menu label="Optional">
<menu-item label="XT Transformer" href="xt-transformer.html"/>
1.1
xml-cocoon2/src/documentation/xdocs/userdocs/transformers/encodeurl-transformer.xml
Index: encodeurl-transformer.xml
===================================================================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.0//EN"
"../../dtd/document-v10.dtd">
<document>
<header>
<title>EncodeURL Transformer</title>
<subtitle>in @doctitle@</subtitle>
<version>0.9</version>
<type>Technical document</type>
<authors>
<person name="Bernhard Huber" email="[EMAIL PROTECTED]"/>
</authors>
<abstract>This document describes the EncodeURL transformer.</abstract>
</header>
<body>
<s1 title="EncodeURL Transformer">
<p>
The encodeURL transformer emits encoded URLs.
This transformer applies encodeURL method to URLs.
You may want to use this transform to avoid doing the manually
encodeURL() call.
</p>
<p>
Usually this transformer is appended as last transformer before
the serialization process. In this case it is possible to encode
URLs introduced in the generator, and xslt transformer phase.
</p>
<p>
You can specify which attributes hold URL values in order to restrict
URL rewriting to specific attributes only. In the current implementation
you specify include, and exclude patterns as regular expressions, concatting
element-name + "/@" + attribute-name.
</p>
<p>
The EncodeURLTransformer has serveral configuration options. These options
may be specified in the sitemap, or by each request.
</p>
<dl>
<dt>include-name</dt>
<dd>RE pattern for including attributes from encode URL rewriting,
The attribute values are encoded, if an
expressions of the form <code>element-name/@attribute-name</code>
matches.
<br/>
By default <code>include-name</code> is defined as
<code>.*/@href|.*/@action|frame/@src</code>.
</dd>
<dt>exclude-name</dt>
<dd>RE pattern for excluding attributes from encode URL rewriting,
The attribute values are not encoded, if an
expressions of the form <code>element-name/@attribute-name</code>
matches.
<br/>
By default <code>exclude-name</code> is defined as
<code>img/@src</code>.
</dd>
</dl>
<ul>
<li>Name : encodeURL</li>
<li>Class: org.apache.cocoon.transformation.EncodeURLTransformer</li>
<li>Cacheable: yes.</li>
</ul>
<p>
A simple example might help to use the EncodeURLTransformer effectivly:
</p>
<p>
Add the EncodeURLTransformer to the components in your sitemap.xmap
</p>
<source><![CDATA[
...
<map:components>
...
<map:transformers default="xslt">
...
<map:transformer name="encodeURL"
src="org.apache.cocoon.transformation.EncodeURLTransformer">
<!-- default configuration, explicitly defined -->
<include-name>.*/@href|.*/@action|frame/@src</include-name>
<exclude-name>img/@src</exclude-name>
</map:transformer>
...
]]></source>
<p>
Next define in your pipeline to use the EncodeURLTransformer
</p>
<source><![CDATA[
<map:match pattern="*.xsp">
<map:generate type="serverpages" name="docs/samples/xsp/{1}.xsp"/>
<map:transform src="stylesheets/page/simple-page2html.xsl"/>
<map:transform type="encodeURL"/>
<map:serialize/>
</map:match>
]]></source>
<p>
In this example pipeline it is assumed that the attribute
<code>href</code> of element <code>a</code> contains an URL which should get
encoded.
Moreover the attribute <code>action</code> of any element contains an URL
which should get encoded, too.
Finally the attribute <code>src</code> of element
<code>frame</code> should get encoded, too.
</p>
<p>
The attribute <code>src</code> of element <code>img</code> is excluded from
encoding.
</p>
<p>
In other words, images are served regardless of the current session, in contrast
anchor links, form actions, and frame src are served depending on the current
session.
</p>
<p>
The encoding itself applies the servlet method <code>response.encodeURL()</code>
upon the URL.
</p>
</s1>
</body>
</document>
----------------------------------------------------------------------
In case of troubles, e-mail: [EMAIL PROTECTED]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]