
Matchers and selectors: conditional processing
Conditional statements are part of any programming language. Output can be dependent on many factors, such as the users’ browser, request parameters, or operating system.
Matchers are the equivalent of If statements. If a condition is true, then a section of a pipeline is processed, or otherwise is passed by.
A selector is used when there are few options available, and it is similar to an
| SAX | SAX | |
File Generator | FileSerializer | ||
FileTransformer | |||
|
| ||
request |
| reponse | |
|
| ||
HTML | XSL StyleSheet | HTML, PDF, etc |
Figure 2-3 Cocoon components
Sitemap
The Cocoon sitemap fulfills two functions:
Components (matchers, generators, serializers, transformers, etc.) are declared here before being used in pipelines.
Where pipelines are declared using the declared components.
It consists of configuration data for the Cocoon engine.
Example 2-14 Sample sitemap for Cocoon
<map:match pattern=”airline.html””> <map:generate src=”docs/flight_data.xml”/> <map:transform src=stylesheets/page/airline.xsl”/> <map:serialize type=”html”/>
</map:match>