There are several components which allow conditional processing to be carried out within Cocoon.
Matchers -- which are simple if structures.
Actions -- while not strictly designed as conditionals, the result of Action processing can dictate whether their child elements are evaluated or not. They are therefore similar to matchers in that they have a simple if structure.
Selectors -- which are if-then-else, or switch structures, and are therefore much more powerful than the other two.
Matchers and Actions both add a new Map to the environment with the results of their processing, while Selectors do not. Key names are arbitrary, and are set by the matcher. For example the regular expression matcher uses key names to identify portions of the regular expression matched (1,2,3, etc).
These new maps are not available to XSP pages, but can be passed into them using named parameters on the generator.
Selectors are generally used later in the pipeline, and work best when there are several clearly defined cases, and the selection of the processing path needn't be parameterised.
Matchers are often the first entry in a pipeline, and are used to select which pipeline is processed. Generally more overhead?
Actions should be used to perform useful work, rather than primarily as conditional elements. Sub pipelines might be skipped if there were errors, or there are two closely related sub-pipes whose use if dependent on the custom actions (e.g. authentication of the user)