crossley 01/11/20 18:40:34 Modified: documentation/xdocs/userdocs/generators Tag: cocoon_20_branch velocity-generator.xml documentation/xdocs/userdocs/transformers Tag: cocoon_20_branch cinclude-transformer.xml Log: Extends the shell doc into full doc. Submitted by: "Bernhard Huber" <[EMAIL PROTECTED]> Reviewed by: [EMAIL PROTECTED] Revision Changes Path No revision No revision 1.1.2.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.1.2.2 retrieving revision 1.1.2.3 diff -u -r1.1.2.2 -r1.1.2.3 --- velocity-generator.xml 2001/10/25 07:43:51 1.1.2.2 +++ velocity-generator.xml 2001/11/21 02:40:34 1.1.2.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="[EMAIL PROTECTED]"/> - </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="[EMAIL PROTECTED]"/> + </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 > 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 <= 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><property key="propertyKey" value="propertyValue"/> + (optional; 0..n)</dt> + <dd> + An additional property to pass along to the Velocity template + engine during initialization + </dd> + + <dt><resource-loader name="loaderName" class="javaClassName"/> + (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 '<name>.resource.loader.' is + automatically added to the property name. + </dd> + + <dt><export-object key="objectMapKey" name="velocityContextName"/> + (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 <export-object + key="objectMapKey" name="velocityContextName"/> child elements + to the generator configuration in the sitemap. + </p> + + </s2> + </s1> + </body> </document> No revision No revision 1.1.2.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.1.2.2 retrieving revision 1.1.2.3 diff -u -r1.1.2.2 -r1.1.2.3 --- cinclude-transformer.xml 2001/10/25 07:43:52 1.1.2.2 +++ cinclude-transformer.xml 2001/11/21 02:40:34 1.1.2.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="[EMAIL PROTECTED]"/> - </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="[EMAIL PROTECTED]"/> + </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>
---------------------------------------------------------------------- In case of troubles, e-mail: [EMAIL PROTECTED] To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]