Content ViewSourceSitemap

Include XML source

<i:include src="itest3.xml"/>

This is the content of the itest3.xml file.


Recursive include

<i:include src="itest4.xml"/>

This is content in itest4.xml, will do a include of itest5.xml here:

This is the content of itest5.xml


Include with fallback (Ok)

<i:include src="itest5.xml">
  <i:fallback>
    <b>Oops!</b> Failed to include a file.
  </i:fallback>
</i:include>
    

This is the content of itest5.xml


Include with fallback (missing file)

<i:include src="does-not-exist.xml">
  <i:fallback>
    <b>Oops!</b> Failed to include a file.
  </i:fallback>
</i:include>
    
Oops! Failed to include a file.

Include with fallback (malformed file)

<i:include src="itest2.xml">
  <i:fallback>
    <b>Oops!</b> Failed to include a file.
  </i:fallback>
</i:include>
    
Oops! Failed to include a file.

Nested includes with fallbacks

<i:include src="itest2.xml">
  <i:fallback>
    <b>Oops!</b> Failed to include a file. Try again:
    <i:include src="itest2.xml">
      <i:fallback>
        <b>Oops!</b> Failed to include a file twice!
      </i:fallback>
    </i:include>
  </i:fallback>
</i:include>
    
Oops! Failed to include a file. Try again: Oops! Failed to include a file twice!

Text include

<i:include src="itest4.xml" parse="text"/>
<?xml version="1.0"?>

<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->

<para xmlns:i="http://apache.org/cocoon/include/1.0">
  This is content in <b>itest4.xml</b>, will do a include of itest5.xml here:
  <i:include src="itest5.xml"/>
</para>