Cocoon Sitemap Generator FAQs
http://xml.apache.org/http://www.apache.org/http://www.w3.org/

Main

FAQs
Index

Getting Started
Install
Configure
CVS

Using
Configure C2
Databases
XSP
XSLT
Debugging

Sitemap
Sitemap
Generators
Transformers
Serializers
Matchers
Selectors
Actions
Aggregators

Questions
Answers
What is a generator?

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.

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.

For conceptual information on generators see the user's guide document The Sitemap. For detailed descriptions about all of the available Cocoon generators, see the user's guide document Generators in Cocoon. You may also wish to consult the Cocoon API documentation.

How can I write my own generator?

See the tutorial Writing a Cocoon 2 generator.

How can I dynamically specify the source for my generator?

For example, I want the <generate>'s src attribute to be defined based on a request.

Here are two solutions (depending on your version of Cocoon):

(1) RequestParamAction (2.0.x + 2.1)

 <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>

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}"/>.

(2) InputModules (2.1)

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

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

How can I add my FAQ to this document?

Follow the instructions found in How-To Author an FAQ.

How can I suggest improvements to existing FAQs?

Given the rapid pace of change with Cocoon, many individual FAQs quickly become out-of-date and confusing to new users. If you have the relevant knowledge, please consider updating other FAQs on this page for technical errors. If you see a few typos, please consider fixing them too. Follow the instructions found in How-To Author an FAQ.

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