| <?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. |
| --> |
| |
| <page xmlns:i="http://apache.org/cocoon/include/1.0"> |
| <title>Include Transformer Demo</title> |
| |
| <content> |
| <!-- |
| - Example 1 |
| --> |
| <h3>Include XML source</h3> |
| <pre><![CDATA[<i:include src="itest3.xml"/>]]></pre> |
| <i:include src="itest3.xml"/> |
| <hr/> |
| |
| <!-- |
| - Example 2 |
| --> |
| <h3>Recursive include</h3> |
| <pre><![CDATA[<i:include src="itest4.xml"/>]]></pre> |
| <i:include src="itest4.xml"/> |
| <hr/> |
| |
| <!-- |
| - Example 3 |
| --> |
| <h3>Include with fallback (Ok)</h3> |
| <pre><![CDATA[ |
| <i:include src="itest5.xml"> |
| <i:fallback> |
| <b>Oops!</b> Failed to include a file. |
| </i:fallback> |
| </i:include> |
| ]]></pre> |
| <i:include src="itest5.xml"> |
| <i:fallback> |
| <b>Oops!</b> Failed to include a file. |
| </i:fallback> |
| </i:include> |
| <hr/> |
| |
| <!-- |
| - Example 4 |
| --> |
| <h3>Include with fallback (missing file)</h3> |
| <pre><![CDATA[ |
| <i:include src="does-not-exist.xml"> |
| <i:fallback> |
| <b>Oops!</b> Failed to include a file. |
| </i:fallback> |
| </i:include> |
| ]]></pre> |
| <i:include src="cocoon:does-not-exist.xml"> |
| <i:fallback> |
| <b>Oops!</b> Failed to include a file. |
| </i:fallback> |
| </i:include> |
| <hr/> |
| |
| <!-- |
| - Example 5 |
| --> |
| <h3>Include with fallback (malformed file)</h3> |
| <pre><![CDATA[ |
| <i:include src="itest2.xml"> |
| <i:fallback> |
| <b>Oops!</b> Failed to include a file. |
| </i:fallback> |
| </i:include> |
| ]]></pre> |
| <i:include src="itest2.xml"> |
| <i:fallback> |
| <b>Oops!</b> Failed to include a file. |
| </i:fallback> |
| </i:include> |
| <hr/> |
| |
| <!-- |
| - Example 6 |
| --> |
| <h3>Nested includes with fallbacks</h3> |
| <pre><![CDATA[ |
| <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> |
| ]]></pre> |
| <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> |
| <hr/> |
| |
| <!-- |
| - Example 6 |
| --> |
| <h3>Text include</h3> |
| <pre><![CDATA[<i:include src="itest4.xml" parse="text"/>]]></pre> |
| <pre><i:include src="itest4.xml" parse="text"/></pre> |
| <hr/> |
| |
| </content> |
| </page> |