You are viewing a plain text version of this content. The canonical link for it is here.
Posted to docs@cocoon.apache.org by da...@cocoon.zones.apache.org on 2005/09/21 16:56:13 UTC
[DAISY] Created: Cocoon Sitemap Generator FAQs
A new document has been created.
http://cocoon.zones.apache.org/daisy/legacydocs/712.html
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
Parts
=====
Content
-------
Mime type: text/xml
Size: 2314 bytes
Content:
<html>
<body>
<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
elements.</p>
<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 a
Cocoon 2 generator</a>.</p>
<h2>How can I dynamically specify the source for my generator?</h2>
<p>For example, I want the <generate>'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> <map:match pattern="tba/*">
<map:act type="request">
<map:parameter name="parameters" value="true"/>
<map:generate src="{page}"/>
<map:transform src="docs/samples/tba/redirect.xsl"/>
<map:serialize type="html"/>
</map:act>
<!-- else ? -->
</map:match>
</pre>
<p>Adding <map:act type="request"> and <map:parameter name="parameters"
value="true"/> 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:
<map:generate src="{page}"/>.</p>
<p>(2) InputModules (2.1)</p>
<pre> <map:match pattern="tba/*">
<map:generate src="{request:page}"/>
<map:transform src="docs/samples/tba/redirect.xsl"/>
<map:serialize type="html"/>
</map:match>
</pre>
<p>In addition, you may want to use ResourceExistsAction to check whether the
provided page exists.</p>
</body>
</html>
Collections
===========
The document belongs to the following collections: legacydocs