cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cross...@apache.org
Subject svn commit: r153722 - in cocoon/branches/BRANCH_2_1_X/src/documentation/xdocs: plan/review-sitemap-docs.xml userdocs/transformers/book.xml userdocs/transformers/jx-template-transformer.xml userdocs/transformers/transformers.xml
Date Mon, 14 Feb 2005 06:13:26 GMT
Author: crossley
Date: Sun Feb 13 22:13:25 2005
New Revision: 153722

URL: http://svn.apache.org/viewcvs?view=rev&rev=153722
Log:
Add some documentation for " JX Template Transformer".
Submitted by: Torsten Schlabach
Issue: 33526 "JXTranformer missing in documentation"

Added:
    cocoon/branches/BRANCH_2_1_X/src/documentation/xdocs/userdocs/transformers/jx-template-transformer.xml
  (with props)
Modified:
    cocoon/branches/BRANCH_2_1_X/src/documentation/xdocs/plan/review-sitemap-docs.xml
    cocoon/branches/BRANCH_2_1_X/src/documentation/xdocs/userdocs/transformers/book.xml
    cocoon/branches/BRANCH_2_1_X/src/documentation/xdocs/userdocs/transformers/transformers.xml

Modified: cocoon/branches/BRANCH_2_1_X/src/documentation/xdocs/plan/review-sitemap-docs.xml
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/documentation/xdocs/plan/review-sitemap-docs.xml?view=diff&r1=153721&r2=153722
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/documentation/xdocs/plan/review-sitemap-docs.xml (original)
+++ cocoon/branches/BRANCH_2_1_X/src/documentation/xdocs/plan/review-sitemap-docs.xml Sun
Feb 13 22:13:25 2005
@@ -2707,7 +2707,7 @@
 </tr>
 <tr>
   <!-- 1 --><td><link href="../apidocs/org/apache/cocoon/transformation/JXTemplateTransformer.html">JXTemplateTransformer</link></td>
-  <!-- 2 --><td></td>
+  <!-- 2 --><td><link href="../userdocs/transformers/jx-template-transformer.html">jx-template</link></td>
   <!-- A --><td>n</td>
   <!-- B --><td>core</td>
   <!-- C --><td>n</td>

Modified: cocoon/branches/BRANCH_2_1_X/src/documentation/xdocs/userdocs/transformers/book.xml
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/documentation/xdocs/userdocs/transformers/book.xml?view=diff&r1=153721&r2=153722
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/documentation/xdocs/userdocs/transformers/book.xml (original)
+++ cocoon/branches/BRANCH_2_1_X/src/documentation/xdocs/userdocs/transformers/book.xml Sun
Feb 13 22:13:25 2005
@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
 <!--
-  Copyright 1999-2004 The Apache Software Foundation
+  Copyright 1999-2005 The Apache Software Foundation
 
   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
@@ -43,6 +43,7 @@
     <menu-item label="EncodeURL Transformer" href="encodeurl-transformer.html"/>
     <menu-item label="SourceWriting Transformer" href="sourcewriting-transformer.html"/>
     <menu-item label="Augment Transformer" href="augment-transformer.html"/>
+    <menu-item label="JX Template Transformer" href="jx-template-transformer.html"/>
   </menu>
   <menu label="Optional">
     <menu-item label="LDAP Transformer" href="ldap-transformer.html"/>

Added: cocoon/branches/BRANCH_2_1_X/src/documentation/xdocs/userdocs/transformers/jx-template-transformer.xml
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/documentation/xdocs/userdocs/transformers/jx-template-transformer.xml?view=auto&rev=153722
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/documentation/xdocs/userdocs/transformers/jx-template-transformer.xml
(added)
+++ cocoon/branches/BRANCH_2_1_X/src/documentation/xdocs/userdocs/transformers/jx-template-transformer.xml
Sun Feb 13 22:13:25 2005
@@ -0,0 +1,269 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright 1999-2005 The Apache Software Foundation
+
+  Licensed 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.
+-->
+<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.0//EN" "document-v10.dtd">
+<document>
+  <!-- This document will be enhanced by information taken from the javadoc -->
+  <header>
+    <title>Description of the JX transformer</title>
+    <version>current</version>
+    <type>Reference</type>
+    <authors>
+      <person email="users@cocoon.apache.org" name="The Cocoon Community"/>
+    </authors>
+  </header>
+  <body>
+    <s1 title="JX Transformer">
+      <p>
+        (<em>JX</em> for <link href="http://jakarta.apache.org/commons/jxpath">Apache
<em>JX</em>Path</link>
+        and <link href="http://jakarta.apache.org/commons/jexl">Apache <em>J</em>e<em>x</em>l</link>).
+      </p>
+      <p>
+        Uses the namespace <code>http://apache.org/cocoon/templates/jx/1.0</code>.
+      </p>
+      <p>
+        Provides a generic page template with embedded JSTL and XPath
+        expression substitution to access data sent by Cocoon Flowscripts.
+      </p>
+      <p>
+        The embedded expression language allows a page author to access an
+        object using a simplified syntax such as
+      </p>
+<source>
+   &lt;site signOn="${accountForm.signOn}"&gt;
+</source>      
+      <p>
+        Embedded JSTL expressions are contained in <code>${}</code>.
+      </p>
+      <p>
+        Embedded XPath expressions are contained in <code>#{}</code>.
+      </p>
+      <p>
+        Note that since this transformer uses
+        <link href="http://jakarta.apache.org/commons/jxpath">Apache JXPath</link>
+        and <link href="http://jakarta.apache.org/commons/jexl">Apache Jexl</link>,
the
+        referenced objects may be Java Beans, DOM, JDOM, or JavaScript objects from
+        a Flowscript. In addition the following implicit objects are available as
+        both XPath and JSTL variables:
+      </p>
+      <table>
+        <tr>
+          <td><code>request</code> (<code>org.apache.cocoon.environment.Request</code>)</td>
+          <td>The Cocoon current request</td>
+        </tr>
+        <tr>
+          <td><code>session</code> (<code>org.apache.cocoon.environment.Session</code>)</td>
+          <td>The Cocoon session associated with the current request</td>
+        </tr>
+        <tr>
+          <td><code>context</code> (<code>org.apache.cocoon.environment.Context</code>)</td>
+          <td>The Cocoon context associated with the current request</td>
+        </tr>
+        <tr>
+          <td><code>parameters</code> (<code>org.apache.avalon.framework.parameters.Parameters</code>)</td>
+          <td>A map of parameters passed to the transformer in the pipeline</td>
+        </tr>
+      </table>
+      <p>
+  The current Web Continuation from the Flowscript
+  is also available as a variable named <code>continuation</code>. You would
+  typically access its <code>id</code>:
+      </p>
+<source>      
+     &lt;form action="${continuation.id}"&gt;
+</source>      
+
+  <p>You can also reach previous continuations by using the
+  <code>getContinuation()</code> function:</p>
+ 
+<source>      
+      &lt;form action="${continuation.getContinuation(1).id}" >
+</source>      
+ <p>The <code>template</code> tag defines a new template:</p>
+<source>      
+     &lt;template&gt;
+        body
+     &lt;/template&gt;
+</source>      
+ 
+  <p>The <code>import</code> tag allows you to include another template
+  within the current template. The content of the imported template is
+  compiled and will be executed in place of the <code>import</code> tag:</p>
+<source>
+    &lt;import uri="URI" [context="Expression"]/&gt;
+</source>
+ <p>The Cocoon source resolver is used to resolve <code>uri</code>.
+ If <code>context</code> is present, then its value is used as the context
+ for evaluating the imported template, otherwise the current context is
+ used.</p>
+ <p>The <code>set</code> tag creates a local alias of an object. The
+ <code>var</code> attribute specifies the name of a variable to assign the
+ object to. The <code>value</code> attribute specifies the object (defaults
+ to <code>body</code> if not present):</p>
+
+<source>      
+     &lt;set var="Name" [value="Value"]&gt;
+         [body]
+     &lt;/set&gt;
+</source>      
+ <p>If used within a <code>macro</code> definition (see below)
+ variables created by <code>set</code> are only visible within the body of
+ the <code>macro</code>.</p>
+ <p>The <code>if</code> tag allows the conditional execution of its body
+ according to value of a <code>test</code> attribute:</p>
+
+<source>      
+    &lt;if test="Expression"&gt;
+        body
+    &lt;/if&gt;
+</source>      
+ <p>The <code>choose</code> tag performs conditional block execution by
the
+  embedded <code>when</code> sub tags. It renders the body of the first
+  <code>when</code> tag whose <code>test</code> condition evaluates
to true.
+  If none of the <code>test</code> conditions of nested <code>when</code>
tags
+  evaluate to <code>true</code>, then the body of an <code>otherwise</code>
+  tag is evaluated, if present:</p>
+<source>      
+   &lt;choose&gt;
+     &lt;when test="Expression"&gt;
+        body
+     &lt;/when&gt;
+     &lt;otherwise&gt;
+        body
+     &lt;/otherwise&gt;
+   &lt;/choose&gt;
+</source>      
+  <p>The <code>out</code> tag evaluates an expression and outputs
+  the result of the evaluation:</p>
+<source>      
+  &lt;out value="Expression"/&gt;
+</source>      
+  <p>The <code>forEach</code> tag allows you to iterate over a collection
+  of objects:</p>
+<source>      
+    &lt;forEach [var="Name"] [items="Expression"]
+                 [begin="Number"] [end="Number"] [step="Number"]&gt;
+      body
+   &lt;/forEach&gt;
+</source>      
+  <p>The <code>items</code> attribute specifies the list of items to iterate
+  over. The <code>var</code> attribute specifies the name of a variable to
+  hold the current item. The <code>begin</code> attribute specifies the
+  element to start with (<code>0</code> = first item,
+  <code>1</code> = second item, ...).
+  If unspecified it defaults to <code>0</code>. The <code>end</code>
+  attribute specifies the item to end with (<code>0</code> = first item,
+  <code>1</code> = second item, ...). If unspecified it defaults to the last
+  item in the list. Every <code>step</code> items are
+  processed (defaults to <code>1</code> if <code>step</code> is absent).
+  Either <code>items</code> or both <code>begin</code> and <code>end</code>
+  must be present.</p>
+ 
+  <p>
+  The <code>formatNumber</code> tag is used to display numeric data, including
+  currencies and percentages, in a locale-specific manner. The
+  <code>formatNumber</code> action determines from the locale, for example,
+  whether to use a period or a comma for delimiting the integer and decimal
+  portions of a number. Here is its syntax:
+  </p>
+<source>      
+  &lt;formatNumber value="Expression"
+      [type="Type"] [pattern="Expression"]
+      [currencyCode="Expression"] [currencySymbol="Expression"]
+      [maxIntegerDigits="Expression"] [minIntegerDigits="Expression"]
+      [maxFractionDigits="Expression"] [minFractionDigits="Expression"]
+      [groupingUsed="Expression"]
+      [var="Name"] [locale="Expression"]&gt;
+</source>      
+ 
+  <p>The <code>formatDate</code> tag provides facilities to format Date
values:</p>
+<source>      
+  &lt;formatDate value="Expression" [dateStyle="Style"]
+    [timeStyle="Style"] [pattern="Expression"] [type="Type"] [var="Name"]
+    [locale="Expression"]&gt;
+</source>      
+ 
+  <p>The <code>macro</code> tag allows you define a new custom tag.</p>
+ 
+<source>      
+  &lt;macro name="Name" [targetNamespace="Namespace"]&gt;
+    &lt;parameter name="Name" [optional="Boolean"] [default="Value"]/&gt;
+    body
+  &lt;/macro&gt;
+</source>      
+ 
+ <p>For example:</p>
+ 
+<source>      
+  &lt;c:macro name="d"&gt;
+    &lt;tr&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;
+  &lt;/c:macro&gt;
+</source>      
+ 
+  <p>The tag being defined in this example is <code>&lt;d&gt;</code>
and it
+  can be used like any other tag:</p>
+ 
+<source>      
+    &lt;d/&gt;
+</source>      
+ 
+  <p>However, when this tag is used it will be replaced with a row containing
+  a single empty data cell.</p>
+  <p> When such a tag is used, the attributes and content of the tag become
+  available as variables in the body of the <code>macro</code>'s definition,
+  for example:</p>
+ 
+<source>      
+  &lt;c:macro name="tablerows"&gt;
+    &lt;c:parameter name="list"/&gt;
+    &lt;c:parameter name="color"/&gt;
+    &lt;c:forEach var="item" items="${list}"&gt;
+      &lt;tr&gt;&lt;td bgcolor="${color}"&gt;${item}&lt;/td&gt;&lt;/tr&gt;
+    &lt;/c:forEach&gt;
+  &lt;/c:macro&gt;
+</source>      
+ 
+  <p>The <code>parameter</code> tags in the macro definition define formal
+  parameters, which are replaced with the actual attribute values of the
+  tag when it is used. The content of the tag is also available as a special
+  variable <code>${content}</code>.</p>
+  <p>Assuming you had this code in your
+  flowscript:</p>
+  <source>var greatlakes = ["Superior", "Michigan", "Huron", "Erie", "Ontario"];</source>
+ <p><code> sendPage(uri, {greatlakes: greatlakes});</code>
+ </p>
+ <p>and a template like this:</p>
+ 
+<source>      
+     &lt;tablerows list="${greatlakes}" color="blue"/&gt;
+  &lt;/table&gt;
+</source>      
+ 
+  <p>When the <code>tablerows</code> tag is used in this situation the
+  following output would be generated:
+  </p>
+<source>      
+  &lt;table&gt;
+    &lt;tr&gt;&lt;td bgcolor="blue"&gt;Superior&lt;/td&gt;&lt;/tr&gt;
+    &lt;tr&gt;&lt;td bgcolor="blue"&gt;Michigan&lt;/td&gt;&lt;/tr&gt;
+    &lt;tr&gt;&lt;td bgcolor="blue"&gt;Huron&lt;/td&gt;&lt;/tr&gt;
+    &lt;tr&gt;&lt;td bgcolor="blue"&gt;Erie&lt;/td&gt;&lt;/tr&gt;
+    &lt;tr&gt;&lt;td bgcolor="blue"&gt;Ontario&lt;/td&gt;&lt;/tr&gt;
+  &lt;/table&gt;
+</source>
+    </s1>
+  </body>
+</document>

Propchange: cocoon/branches/BRANCH_2_1_X/src/documentation/xdocs/userdocs/transformers/jx-template-transformer.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: cocoon/branches/BRANCH_2_1_X/src/documentation/xdocs/userdocs/transformers/transformers.xml
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/documentation/xdocs/userdocs/transformers/transformers.xml?view=diff&r1=153721&r2=153722
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/documentation/xdocs/userdocs/transformers/transformers.xml
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/documentation/xdocs/userdocs/transformers/transformers.xml
Sun Feb 13 22:13:25 2005
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
-  Copyright 1999-2004 The Apache Software Foundation
+  Copyright 1999-2005 The Apache Software Foundation
 
   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
@@ -57,6 +57,7 @@
   <li><link href="encodeurl-transformer.html">EncodeURL Transformer</link></li>
   <li><link href="sourcewriting-transformer.html">SourceWriting Transformer</link></li>
     <li><link href="augment-transformer.html">Augment Transformer</link></li>
+    <li><link href="jx-template-transformer.html">JX Template Transformer</link></li>
   <li><link href="ldap-transformer.html">LDAP Transformer</link> (optional)</li>
     <li><link href="lexer-transformer.html">Lexical Transformer</link>
(optional)</li>
     <li><link href="parser-transformer.html">Parser Transformer</link>
(optional)</li>



Mime
View raw message