cocoon-docs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From da...@cocoon.zones.apache.org
Subject [DAISY] Updated: XIncludeTransformer
Date Mon, 04 Jun 2007 20:27:58 GMT
A document has been updated:

http://cocoon.zones.apache.org/daisy/documentation/985.html

Document ID: 985
Branch: main
Language: default
Name: XIncludeTransformer (unchanged)
Document Type: Sitemap Component (unchanged)
Updated on: 6/4/07 8:27:49 PM
Updated by: Alexander Klimetschek

A new version has been created, state: publish

Parts
=====

Short description
-----------------
This part has been updated.
Mime type: text/xml (unchanged)
File name:  (unchanged)
Size: 3073 bytes (previous version: 81 bytes)
Content diff:
    <html>
    <body>
    
--- <p>Implementation of an XInclude transformer.</p>
+++ <p>This transformer works according to the XInclude specification.</p>
    
+++ <p>For more information refer to the
+++ <a href="http://www.w3.org/TR/xinclude">XInclude specification</a>.</p>
+++ 
+++ <ul>
+++ <li>Name : xinclude</li>
+++ <li>Class: org.apache.cocoon.transformation.XIncludeTransformer</li>
+++ <li>Cacheable: yes.</li>
+++ </ul>
+++ 
+++ <p>You can include either simple text, or xml content. Including xml content --
+++ which is the default -- gives you the option to define an xpointer in the href
+++ attribute. Some quick xinclude examples should reveal the possibilities of
+++ xinclude.</p>
+++ 
+++ <ul>
+++ <li>Include an xml content as-is: <tt>&lt;xi:include
+++ href="include.xml"/&gt;</tt></li>
+++ <li>Include an xml content but pick the strong element only: <tt>&lt;xi:include
+++ href="include.xml#xpointer(/p/strong)"/&gt;</tt></li>
+++ <li>Include text content: <tt>&lt;xi:include parse="text"
+++ href="include.txt"/&gt;</tt></li>
+++ </ul>
+++ 
+++ <p>A simple example using xinclude might help to use this transfomer
+++ effectively:</p>
+++ 
+++ <p>Add the XIncludetransfomer to the components in your sitemap.xmap</p>
+++ 
+++ <pre>...
+++ &lt;map:components&gt;
+++ ...
+++   &lt;map:transformers default="xslt"&gt;
+++   ...
+++     &lt;map:transformer name="xinclude"
+++       src="org.apache.cocoon.transformation.XIncludeTransformer"/&gt;
+++   ...
+++ </pre>
+++ 
+++ <p>Next define in your pipeline to use the XIncludeTransformer</p>
+++ 
+++ <pre>&lt;map:match pattern="xinc/simple-xinc"&gt;
+++   &lt;map:generate src="xinc/simple-xinc.xml"/&gt;
+++   &lt;map:transform type="xinclude"/&gt;
+++   &lt;map:transform src="stylesheets/page/simple-page2html.xsl"/&gt;
+++   &lt;map:serialize/&gt;
+++ &lt;/map:match&gt;
+++ </pre>
+++ 
+++ <p>In this example pipeline it assumed that simple-xinc.xml contains the include
+++ element. As well as defining the include element, it defines the namespace URI
+++ "http://www.w3.org/2001/XInclude". This helps the XIncludeTransformer to find
+++ the include element to get replaced by the included content. The simple-xinc.xml
+++ may look like this:</p>
+++ 
+++ <pre>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
+++ &lt;page 
+++   xmlns:xi="http://www.w3.org/2001/XInclude"&gt;
+++   &lt;title&gt;Hello&lt;/title&gt;
+++   &lt;content&gt;
+++     &lt;para&gt;This is my first Cocoon page!&lt;/para&gt;
+++     &lt;xi:include href="include.xml"/&gt;
+++   &lt;/content&gt;
+++ &lt;/page&gt;
+++ </pre>
+++ 
+++ <p>Next you should define the include.xml file which is included. A simple
+++ include.xml might look like this:</p>
+++ 
+++ <pre>&lt;?xml version="1.0"?&gt;
+++ &lt;p&gt;
+++   I am &lt;strong&gt;included&lt;/strong&gt; by XIncludeTransformer.
+++   I come from "include.xml".
+++ &lt;/p&gt;
+++ </pre>
+++ 
+++ <p>Now finally we have everything put together the xml content after the
+++ XIncludeTransformer processing will look like this:</p>
+++ 
+++ <pre>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
+++ &lt;page 
+++   xmlns:xi="http://www.w3.org/2001/XInclude"&gt;
+++   &lt;title&gt;Hello&lt;/title&gt;
+++   &lt;content&gt;
+++     &lt;para&gt;This is my first Cocoon page!&lt;/para&gt;
+++       &lt;p&gt;
+++        I am &lt;strong&gt;included&lt;/strong&gt; by XIncludeTransformer.
+++        I come from "include.xml".
+++       &lt;/p&gt;
+++   &lt;/content&gt;
+++ &lt;/page&gt;
+++ </pre>
+++ 
    </body>
    </html>


Mime
View raw message