apache > cocoon

- Home

# Aggregator FAQs

##

## What is an Aggregator?

An aggregator produces XML content. It is composed of one or more parts, each of which defined by an XML source. During pipeline processing, all parts of an aggregator are merged. The name of the parent element which contains the merged XML content from each part is defined by the value of the map:aggregate's attribute called element.

In the example below,the XML content of pipelines matching `book-*.xml` and `body-*.xml` are aggregated, having a root element called site.

    <map:match pattern="*.html">
     <map:aggregate element="site">
      <map:part src="cocoon:/book-{1}.xml"/>
      <map:part src="cocoon:/body-{1}.xml"/>
     </map:aggregate>
     ...

The aggregated XML content could look like this:

    <site>
     <menu>
      <!-- content of book XML -->
      ...
     </menu>
     <document>
      <!-- content of body XML -->
      ...
     </document>
    </site>

## Where can I learn more about content aggregation?

Learn more about content aggregation by downloading the free chapter, A User's Look at the Cocoon architecture, from Langham and Ziegeler's Cocoon: Building XML Applications available at the New Riders web site.

Errors and Improvements? If you see any errors or potential improvements in this document please help us: View, Edit or comment on the latest development version (registration required).