cocoon-docs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject [DAISY] Created: Cocoon Sitemap Generator FAQs
Date Wed, 21 Sep 2005 14:56:13 GMT
A new document has been created.

Document ID: 712
Branch: main
Language: default
Name: Cocoon Sitemap Generator FAQs
Document Type: Document
Created: 9/21/05 2:55:53 PM
Creator (owner): Helma van der Linden
State: publish


Mime type: text/xml
Size: 2314 bytes

<h2>What is a generator?</h2>

<p>A generator is the starting point of an xml pipeline. It generates XML
content as SAX events and initializes pipeline processing. Every pipeline match
containing a generator must be terminated by a serializer.</p>

<p>In the sitemap file, each generator has a unique name which is mapped to a
java class. One generator name must be declared as the default generator. Each
generator may have additional configuration information specified in child

<p>For conceptual information on generators see the user's guide document
<a href="../userdocs/concepts/sitemap.html">The Sitemap</a>. For detailed
descriptions about all of the available Cocoon generators, see the user's guide
document <a href="../userdocs/concepts/sitemap.html">Generators in Cocoon</a>.
You may also wish to consult the Cocoon API documentation.</p>

<h2>How can I write my own generator?</h2>

<p>See the tutorial <a href="../tutorial/tutorial-rmi-generator.html">Writing
Cocoon 2 generator</a>.</p>

<h2>How can I dynamically specify the source for my generator?</h2>

<p>For example, I want the &lt;generate&gt;'s src attribute to be defined based
on a request.</p>

<p>Here are two solutions (depending on your version of Cocoon):</p>

<p>(1) RequestParamAction (2.0.x + 2.1)</p>

<pre>  &lt;map:match pattern="tba/*"&gt;
    &lt;map:act type="request"&gt;
	  &lt;map:parameter name="parameters" value="true"/&gt;
	  &lt;map:generate src="{page}"/&gt;
 	  &lt;map:transform src="docs/samples/tba/redirect.xsl"/&gt;
 	  &lt;map:serialize type="html"/&gt;
    &lt;!-- else ? --&gt;

<p>Adding &lt;map:act type="request"&gt; and &lt;map:parameter name="parameters"
value="true"/&gt; makes it possible to get the page request attribute. Then, you
can define the src attribute by using the value of the page attribute like this:
&lt;map:generate src="{page}"/&gt;.</p>

<p>(2) InputModules (2.1)</p>

<pre> &lt;map:match pattern="tba/*"&gt;
 	&lt;map:generate src="{request:page}"/&gt;
 	&lt;map:transform src="docs/samples/tba/redirect.xsl"/&gt;
 	&lt;map:serialize type="html"/&gt;

<p>In addition, you may want to use ResourceExistsAction to check whether the
provided page exists.</p>


The document belongs to the following collections: legacydocs

View raw message