You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by cr...@apache.org on 2001/11/21 03:40:30 UTC

cvs commit: xml-cocoon2/documentation/xdocs/userdocs/transformers cinclude-transformer.xml xinclude-transformer.xml

crossley    01/11/20 18:40:30

  Modified:    documentation/xdocs/userdocs/generators
                        velocity-generator.xml
               documentation/xdocs/userdocs/transformers
                        cinclude-transformer.xml xinclude-transformer.xml
  Log:
  Extends the shell doc into full doc.
  Submitted by:	"Bernhard Huber" <be...@a1.net>
  Reviewed by:	crossley@apache.org
  
  Revision  Changes    Path
  1.3       +125 -24   xml-cocoon2/documentation/xdocs/userdocs/generators/velocity-generator.xml
  
  Index: velocity-generator.xml
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/documentation/xdocs/userdocs/generators/velocity-generator.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- velocity-generator.xml	2001/10/25 07:49:14	1.2
  +++ velocity-generator.xml	2001/11/21 02:40:30	1.3
  @@ -2,28 +2,129 @@
   <!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.0//EN" "../../dtd/document-v10.dtd">
   
   <document>
  -	<header>
  -		<title>Velocity Generator</title>
  -		<version>0.9</version>
  -		<type>Technical document</type>
  -		<authors>
  -			<person name="Carsten Ziegeler" email="cziegeler@apache.org"/>
  -		 </authors>
  -		 <abstract>This document describes the file velocity of Cocoon.</abstract>
  -	</header>
  -	<body>
  -		<s1 title="Velocity Generator">
  -			<p>.</p>
  -			<ul>
  -				<li>Name : velocity</li>
  -				<li>Class: org.apache.cocoon.generation.VelocityGenerator</li>
  -				<li>Cacheable: ????.</li>
  -			</ul>
  -<source>
  -     <![CDATA[
  -  <map:generate type="velocity"/>
  -     ]]>
  -</source>
  -		</s1>
  -	</body>
  + <header>
  +  <title>Velocity Generator</title>
  +  <subtitle>in @doctitle@</subtitle>
  +  <version>0.9</version>
  +  <type>Technical document</type>
  +  <authors>
  +  <person name="Carsten Ziegeler" email="cziegeler@apache.org"/>
  +  </authors>
  +  <abstract>This document describes the Velocity template generator.</abstract>
  + </header>
  + <body>
  +  <s1 title="Velocity Generator">
  +  <p>
  +   Allows Velocity template to be used as a generator. 
  +   Builds upon the Velocity servlet functionality - overrides 
  +   the output method in order to pipe the results into SAX events.
  +  </p>
  +  
  +  <ul>
  +   <li>Name : velocity</li>
  +   <li>Class: org.apache.cocoon.generation.VelocityGenerator</li>
  +   <li>Cacheable: ????.</li>
  +  </ul>
  +  <source>
  +<![CDATA[
  +<map:generate type="velocity"/>
  +]]>
  +  </source>
  +
  +  <p>
  +   Cocoon Generator that produces dynamic XML SAX events
  +   from a Velocity template file.
  +  </p>
  + 
  +  <s2 title="Sitemap Configuration">
  +   <p>
  +    Attributes:
  +   </p>
  +   <dl>
  +    <dt>usecache (optional; default: 'false')</dt> 
  +    <dd>
  +     set to 'true' to enable template caching on the 'cocoon'
  +     resource loader
  +    </dd>
  +   
  +    <dt>checkInterval (optional; default: '0')</dt>
  +    <dd>
  +     This is the number of seconds between modification checks when
  +     caching is turned on.  When this is an integer &gt; 0, this represents
  +     the number of seconds between checks to see if the template was
  +     modified. If the template has been modified since last check, then
  +     it is reloaded and reparsed. Otherwise nothing is done. When &lt;= 0,
  +     no modification checks will take place, and assuming that the
  +     property cache (above) is true, once a template is loaded and
  +     parsed the first time it is used, it will not be checked or
  +     reloaded after that until the application or servlet engine is
  +     restarted.
  +    </dd>
  +   </dl>
  + 
  +   <p>
  +   Child Elements:
  +   </p>
  +   
  +   <dl>
  +    <dt>&lt;property key="propertyKey" value="propertyValue"/&gt;
  +     (optional; 0..n)</dt>
  +    <dd>
  +     An additional property to pass along to the Velocity template
  +     engine during initialization
  +    </dd>
  +    
  +    <dt>&lt;resource-loader name="loaderName" class="javaClassName"/&gt;
  +     (optional; 0..n; children: property*)</dt>
  +    <dd>
  +     The default configuration uses the 'cocoon' resource loader
  +     which resolves resources via the Cocoon SourceResolver. Additional
  +     resource loaders can be added with this configuration
  +     element. Configuration properties for the resource loader can be
  +     specified by adding a child property element of the resource-loader
  +     element. The prefix '&lt;name&gt;.resource.loader.' is
  +     automatically added to the property name.
  +    </dd>
  +    
  +    <dt>&lt;export-object key="objectMapKey" name="velocityContextName"/&gt;
  +     (optional; 0..n)</dt>
  +    <dd>
  +     Export the object specified by <em>key</em> from the Cocoon
  +     object map to the Velocity context of the template.  The object can
  +     be accessed from the template as <em>name</em>. Be careful to use a
  +     valid VTL variable name.
  +    </dd>
  +   </dl>
  + 
  +   <p>
  +    Default Java objects exported to the Velocity context:
  +   </p>
  +   
  +   <dl>
  +    <dt>request (org.apache.cocoon.environment.Request)</dt>
  +    <dd>The Cocoon current request</dd>
  +    
  +    <dt>template (java.lang.String)</dt>
  +    <dd>The path of the template file currently being evaluated</dd>
  +    
  +    <dt>response (org.apache.cocoon.environment.Response)</dt>
  +    <dd>The Cocoon response associated with the current request</dd>
  +    
  +    <dt>context (org.apache.cocoon.environment.Context)</dt>
  +    <dd>The Cocoon context associated with the current request</dd>
  +    
  +    <dt>parameters (org.apache.avalon.framework.parameters.Parameters)</dt>
  +    <dd>Any parameters passed to the generator in the pipeline</dd>
  +   </dl>
  + 
  +   <p>
  +    Additional Java objects can be exported from the Cocoon object
  +    map to the Velocity context by adding one or more &lt;export-object
  +    key="objectMapKey" name="velocityContextName"/&gt; child elements
  +    to the generator configuration in the sitemap.
  +   </p>
  + 
  +  </s2>
  + </s1>
  + </body>
   </document>
  
  
  
  1.3       +124 -25   xml-cocoon2/documentation/xdocs/userdocs/transformers/cinclude-transformer.xml
  
  Index: cinclude-transformer.xml
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/documentation/xdocs/userdocs/transformers/cinclude-transformer.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- cinclude-transformer.xml	2001/10/25 07:49:15	1.2
  +++ cinclude-transformer.xml	2001/11/21 02:40:30	1.3
  @@ -2,29 +2,128 @@
   <!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.0//EN" "../../dtd/document-v10.dtd">
   
   <document>
  -	<header>
  -		<title>CInclude Transformer</title>
  -		<version>0.9</version>
  -		<type>Technical document</type>
  -		<authors>
  -			<person name="Carsten Ziegeler" email="cziegeler@apache.org"/>
  -		 </authors>
  -		 <abstract>This document describes the CInclude transformer of Cocoon.</abstract>
  -	</header>
  -	<body>
  -		<s1 title="CInclude Transformer">
  -<p>This transformer triggers for the element <code>include</code> in the
  -   namespace "http://apache.org/cocoon/include/1.0".
  -   The <code>src></code> attribute contains the url which points to
  -   an xml resource which is include instead of the element.
  -   With the attributes <code>element</code>, <code>ns</code> and
  -   <code>prefix</code> it is possible to specify an element
  -   which surrounds the included content.</p>
  -			<ul>
  -				<li>Name : cinclude</li>
  -				<li>Class: org.apache.cocoon.transformation.CIncludeTransformer</li>
  -				<li>Cacheable: no.</li>
  -			</ul>
  -		</s1>
  -	</body>
  + <header>
  +  <title>CInclude Transformer</title>
  +  <subtitle>in @doctitle@</subtitle>
  +  <version>0.9</version>
  +  <type>Technical document</type>
  +  <authors>
  +   <person name="Carsten Ziegeler" email="cziegeler@apache.org"/>
  +  </authors>
  +  <abstract>This document describes the CInclude transformer.</abstract>
  + </header>
  + <body>
  +  <s1 title="CInclude Transformer">
  +   <p>
  +    This transformer triggers for the element <code>include</code> in the
  +    namespace "http://apache.org/cocoon/include/1.0".
  +    The <code>src</code> attribute contains the url which points to
  +    an xml resource which is included instead of the element.
  +    With the attributes <code>element</code>, <code>ns</code> and
  +    <code>prefix</code> it is possible to specify an element
  +    which surrounds the included content.
  +   </p>
  +   <ul>
  +    <li>Name : cinclude</li>
  +    <li>Class: org.apache.cocoon.transformation.CIncludeTransformer</li>
  +    <li>Cacheable: no.</li>
  +   </ul>
  +   <ul>
  +    <li>Name : cinclude</li>
  +    <li>Class: org.apache.cocoon.transformation.CachingCIncludeTransformer</li>
  +    <li>Cacheable: yes.</li>
  +   </ul>
  +   <p>
  +    There are two versions of CIncludeTransformer available:
  +   </p>
  +   <ul>
  +    <li>A non caching version
  +     <code>org.apache.cocoon.transformation.CIncludeTransformer</code>
  +    </li>
  +    <li>A caching version
  +     <code>org.apache.cocoon.transformation.CachingCIncludeTransformer</code>
  +    </li>
  +   </ul>
  +   <p>
  +    A simple example might help to use the CIncludeTransfomer effectivly:
  +   </p>
  +   <p>
  +    Add the CIncludeTransformer to the components in your sitemap.xmap
  +   </p>
  +<source><![CDATA[
  +...
  +<map:components>
  +...
  +  <map:transformers default="xslt">
  +  ...
  +    <map:transformer name="cinclude"
  +      src="org.apache.cocoon.transformation.CIncludeTransformer"/>
  +  ...
  +]]></source>
  +   <p>
  +     Next define in your pipeline to use the CIncludeTransformer
  +   </p>
  +<source><![CDATA[
  +<map:match pattern="cinc/simple-cinc">
  +  <map:generate src="cinc/simple-cinc.xml"/>
  +  <map:transform type="cinclude"/>
  +  <map:transform src="stylesheets/page/simple-page2html.xsl"/>
  +  <map:serialize/>
  +</map:match>
  +]]></source>
  +
  +   <p>
  +    In this example pipeline it assumed that simple-cinc.xml contains
  +    the include element. Beside defining the include element
  +    it defines the namespache URI "http://apache.org/cocoon/include/1.0".
  +    This helps the CIncludeTransformer to find the tag to get replaced by
  +    the xml content referenced via the src attribute.
  +    The simple-cinc.xml may look like this:
  +   </p>
  +<source><![CDATA[
  +<?xml version="1.0" encoding="UTF-8"?>
  +<page 
  +  xmlns:cinclude="http://apache.org/cocoon/include/1.0">
  +  <title>Hello</title>
  +  <content>
  +    <para>This is my first Cocoon2 page!</para>
  +    <cinclude:include src="include.xml" element="included"/>
  +  </content>
  +</page>
  +]]></source>
  +
  +   <p>
  +    Next you should define the include.xml file which is included.
  +    A simple include.xml might look like this:
  +   </p>
  +<source><![CDATA[
  +<?xml version="1.0"?>
  +<p>
  + I am <strong>included</strong> by CIncludeTransformer.
  + I come from "include.xml".
  +</p>
  +]]></source>
  +
  +   <p>
  +    Now finally we have everything put together the xml content after the
  +    CIncludeTransformer processing will look like this:
  +   </p>
  +<source><![CDATA[
  +<?xml version="1.0" encoding="UTF-8"?>
  +<page 
  +  xmlns:cinclude="http://apache.org/cocoon/include/1.0">
  +  <title>Hello</title>
  +  <content>
  +    <para>This is my first Cocoon2 page!</para>
  +    <included>
  +      <p>
  +        I am <strong>included</strong> by CIncludeTransformer.
  +        I come from "include.xml".
  +      </p>
  +    </included>
  +  </content>
  +</page>
  +]]></source>
  +  </s1>
  + </body>
   </document>
  
  
  
  1.3       +127 -20   xml-cocoon2/documentation/xdocs/userdocs/transformers/xinclude-transformer.xml
  
  Index: xinclude-transformer.xml
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/documentation/xdocs/userdocs/transformers/xinclude-transformer.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- xinclude-transformer.xml	2001/10/25 07:49:15	1.2
  +++ xinclude-transformer.xml	2001/11/21 02:40:30	1.3
  @@ -2,24 +2,131 @@
   <!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.0//EN" "../../dtd/document-v10.dtd">
   
   <document>
  -	<header>
  -		<title>XInclude Transformer</title>
  -		<version>0.9</version>
  -		<type>Technical document</type>
  -		<authors>
  -			<person name="Carsten Ziegeler" email="cziegeler@apache.org"/>
  -		 </authors>
  -		 <abstract>This document describes the XInclude transformer of Cocoon.</abstract>
  -	</header>
  -	<body>
  -		<s1 title="XInclude Transformer">
  -			<p>This transformer works according to the XInclude specification.</p>
  -			<p>For more information refer to the <link href="http://www.w3.org/TR/xinclude">XInclude specification</link>.</p>
  -			<ul>
  -				<li>Name : xinclude</li>
  -				<li>Class: org.apache.cocoon.transformation.XIncludeTransformer</li>
  -				<li>Cacheable: no.</li>
  -			</ul>
  -		</s1>
  -	</body>
  + <header>
  +  <title>XInclude Transformer</title>
  +  <subtitle>in @doctitle@</subtitle>
  +  <version>0.9</version>
  +  <type>Technical document</type>
  +  <authors>
  +  <person name="Carsten Ziegeler" email="cziegeler@apache.org"/>
  +  </authors>
  +  <abstract>This document describes the XInclude transformer.</abstract>
  + </header>
  + <body>
  +  <s1 title="XInclude Transformer">
  +   <p>
  +    This transformer works according to the XInclude specification.
  +   </p>
  +   <p>
  +    For more information refer to the
  +    <link href="http://www.w3.org/TR/xinclude">XInclude specification</link>.
  +   </p>
  +   <ul>
  +    <li>Name : xinclude</li>
  +    <li>Class: org.apache.cocoon.transformation.XIncludeTransformer</li>
  +    <li>Cacheable: no.</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: 
  +     <code><![CDATA[<xi:include href="include.xml"/>]]></code>
  +    </li>
  +    <li>
  +     Include an xml content but pick the strong element only:
  +     <code><![CDATA[<xi:include href="include.xml#xpointer(/p/strong)"/>]]></code>
  +    </li>
  +    <li>
  +     Include text content:
  +     <code><![CDATA[<xi:include parse="text" href="include.txt"/>]]></code>
  +    </li>
  +   </ul>
  +
  +   <p>
  +    A simple example using xinclude might help to use this transfomer
  +    effectivly:
  +   </p>
  +   <p>
  +    Add the XIncludetransfomer to the components in your sitemap.xmap
  +   </p>
  +<source><![CDATA[
  +...
  +<map:components>
  +...
  +  <map:transformers default="xslt">
  +  ...
  +    <map:transformer name="xinclude"
  +      src="org.apache.cocoon.transformation.XIncludeTransformer"/>
  +  ...
  +]]></source>
  +
  +   <p>
  +    Next define in your pipeline to use the XIncludeTransformer
  +   </p>
  +<source><![CDATA[
  +<map:match pattern="xinc/simple-xinc">
  +  <map:generate src="xinc/simple-xinc.xml"/>
  +  <map:transform type="xinclude"/>
  +  <map:transform src="stylesheets/page/simple-page2html.xsl"/>
  +  <map:serialize/>
  +</map:match>
  +]]></source>
  +
  +   <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 namespache 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>
  +<source><![CDATA[
  +<?xml version="1.0" encoding="UTF-8"?>
  +<page 
  +  xmlns:xi="http://www.w3.org/2001/XInclude">
  +  <title>Hello</title>
  +  <content>
  +    <para>This is my first Cocoon2 page!</para>
  +    <xi:include href="include.xml"/>
  +  </content>
  +</page>
  +]]></source>
  +
  +   <p>
  +    Next you should define the include.xml file which is included.
  +    A simple include.xml might look like this:
  +   </p>
  +<source><![CDATA[
  +<?xml version="1.0"?>
  +<p>
  +  I am <strong>included</strong> by XIncludeTransformer.
  +  I come from "include.xml".
  +</p>
  +]]></source>
  +
  +   <p>
  +    Now finally we have everything put together the xml content after the 
  +    XIncludeTransformer processing will look like this:
  +   </p>
  +<source><![CDATA[
  +<?xml version="1.0" encoding="UTF-8"?>
  +<page 
  +  xmlns:xi="http://www.w3.org/2001/XInclude">
  +  <title>Hello</title>
  +  <content>
  +    <para>This is my first Cocoon2 page!</para>
  +      <p>
  +       I am <strong>included</strong> by XIncludeTransformer.
  +       I come from "include.xml".
  +      </p>
  +  </content>
  +</page>
  +]]></source>
  +  </s1>
  + </body>
   </document>
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org