CInclude serves the same basic function as XInclude however it is a bit more versatile and is most likely higher performance.

Steps

You must:

This page defines the first two, the second two steps are shown here: AddCIncludeToMinimalSitemap.

Basic Usage

You must include the CInclude transformer in your basic sitemap. From there you must include this:

<page 
  xmlns:cinclude="http://apache.org/cocoon/include/1.0">

to your Page Element. And this:

<cinclude:include src="include.xml" element="included"/>

whereever you wish the content to be included.

Attributes

Example of select and element attribute

<cinclude:include
  src="cocoon:/payment_combo.xml" element="payments" select="xformpayments/*">

This would include all children of "xformpayments" but not "xformpayments" itself, instead the root element will be "payments".

Hint: If your select is returning empty but you're sure you're naming the right nodes you may be selecting from the wrong namespace. When selecting nodes from the document's default namespace (as with most xhtml documents) try selecting the node with //*[local-name()='body']/* where body is the node name.

See this example:

AddCIncludeToMinimalSitemap for information on adding a CInclude tranformer to the basic sitemap.

Advanced use

In cocoon-2.0.4, only the basic CInclude transformer described above is available. Development versions (see WhereToGet21Dev) add a new element, <cinclude:includexml>, which is described in the Cocoon documentation.