sylvain     2003/09/09 11:58:29

  Modified:    src/documentation/xdocs/userdocs/advanced/flow
                        jxtemplate.xml
  Log:
  Add namespace prefixes for jxtemplate tags
  
  Revision  Changes    Path
  1.5       +74 -74    
cocoon-2.1/src/documentation/xdocs/userdocs/advanced/flow/jxtemplate.xml
  
  Index: jxtemplate.xml
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.1/src/documentation/xdocs/userdocs/advanced/flow/jxtemplate.xml,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- jxtemplate.xml    2 Sep 2003 13:53:10 -0000       1.4
  +++ jxtemplate.xml    9 Sep 2003 18:58:29 -0000       1.5
  @@ -31,7 +31,7 @@
    Having an embedded expression language allows a page author to access an 
object using a simple syntax such as
    </p>
   <source>
  - &lt;site signOn="${accountForm.signOn}"&gt;
  +&lt;site signOn="${accountForm.signOn}"&gt;
    </source>
   <p>Embedded Jexl expressions are contained in <code>${}</code>.</p>
   <p>Embedded JXPath expressions are contained in <code>#{}</code>.</p>
  @@ -57,27 +57,27 @@
   <p>
   Jexl Example:</p>
   <source>
  -  The content type of the current request is ${request.contentType}
  +The content type of the current request is ${request.contentType}
   </source>
   <p>
   JXPath Example:</p>
   <source>
  -  The content type of the current request is #{$request/contentType}
  +The content type of the current request is #{$request/contentType}
   </source>
   <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;
  +&lt;form action="${continuation.id}"&gt;
   </source>
   <p>You can also reach previous continuations by using the 
<code>getParent()</code> function:</p>
   <source>
  -    &lt;form action="${continuation.getParent().id}" >
  +&lt;form action="${continuation.getParent().id}" >
   </source>
   <p>or using an XPath expression:</p>
   <source>
  -    &lt;form action="#{getParent($continuation)/id}" >
  +&lt;form action="#{getParent($continuation)/id}" >
   </source>
   </s1>
   <s1 title ="Tags">
  @@ -87,30 +87,30 @@
   </source>
   <s2 title ="template">
   <p>The <code>template</code> tag defines a new template:</p><source>
  -   &lt;t:template xmlns:t="http://apache.org/cocoon/templates/jx/1.0"&gt;
  -       body
  -   &lt;/t:template&gt;
  +&lt;jx:template xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"&gt;
  +   body
  +&lt;/jx:template&gt;
   </source>
    <p/>
   </s2>
   <s2 title ="import"/>
   <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;
  +&lt;jx: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>
   <s2 title ="set">
   <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;
  +&lt;jx:set var="Name" [value="Value"]&gt;
  +   [body]
  +&lt;/jx: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>Jexl Example:</p>
   <source>
  -&lt;set var="greeting" value="Hello ${user}"/&gt;
  +&lt;jx:set var="greeting" value="Hello ${user}"/&gt;
   The value of greeting is ${greeting}
   </source>
   <p>JXPath Example:</p>
   <source>
  -&lt;set var="greeting" value="Hello #{user}"/&gt;
  +&lt;jx:set var="greeting" value="Hello #{user}"/&gt;
   The value of greeting is #{$greeting}
   </source>
    <p/>
  @@ -119,22 +119,22 @@
   <p>The <code>if</code> tag allows the conditional execution of its body 
   according to value of its <code>test</code> attribute:</p>
   <source>
  -  &lt;if test="Expression"&gt;
  -      body
  -  &lt;/if&gt;
  +&lt;jx:if test="Expression"&gt;
  +  body
  +&lt;/jx:if&gt;
   </source>
   <p>Jexl Example:</p>
   <source>
  -&lt;if test="${cart.numberOfItems == 0}"&gt;
  +&lt;jx:if test="${cart.numberOfItems == 0}"&gt;
     Your cart is empty
  -&lt;/if&gt;
  +&lt;/jx:if&gt;
   </source>
   <p/>
   <p>JXPath Example:</p>
   <source>
  -&lt;if test="#{cart/numberOfItems = 0}"&gt;
  +&lt;jx:if test="#{cart/numberOfItems = 0}"&gt;
     Your cart is empty
  -&lt;/if&gt;
  +&lt;/jx:if&gt;
   </source>
    <p/>
   </s2>
  @@ -146,37 +146,37 @@
   evaluate to <code>true</code>, then the body of its <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;
  +&lt;jx:choose&gt;
  +  &lt;jx:when test="Expression"&gt;
  +    body
  +  &lt;/jx:when&gt;+
  +  &lt;jx:otherwise&gt;
  +    body
  +  &lt;/jx:otherwise&gt;?
  +&lt;/jx:choose&gt;
   </source>
   <p>Jexl Example:</p>
   <source>
  -&lt;choose&gt;
  -  &lt;when test="${!user.loggedIn}"&gt;
  -    &lt;set var="label" value="Log in"&gt;
  -  &lt;/when&gt;
  -  &lt;otherwise&gt;
  -    &lt;set var="label" value="Log out"&gt;
  -  &lt;/otherwise&gt;
  -&lt;/choose&gt;
  +&lt;jx:choose&gt;
  +  &lt;jx:when test="${!user.loggedIn}"&gt;
  +    &lt;jx:set var="label" value="Log in"&gt;
  +  &lt;/jx:when&gt;
  +  &lt;jx:otherwise&gt;
  +    &lt;jx:set var="label" value="Log out"&gt;
  +  &lt;/jx:otherwise&gt;
  +&lt;/jx:choose&gt;
   </source>
    <p/>
   <p>JXPath Example:</p>
   <source>
  -&lt;choose&gt;
  -  &lt;when test="#{not(user/loggedIn)}"&gt;
  -    &lt;set var="label" value="Log in"&gt;
  -  &lt;/when&gt;
  -  &lt;otherwise&gt;
  -    &lt;set var="label" value="Log out"&gt;
  -  &lt;/otherwise&gt;
  -&lt;/choose&gt;
  +&lt;jx:choose&gt;
  +  &lt;jx:when test="#{not(user/loggedIn)}"&gt;
  +    &lt;jx:set var="label" value="Log in"&gt;
  +  &lt;/jx:when&gt;
  +  &lt;jx:otherwise&gt;
  +    &lt;jx:set var="label" value="Log out"&gt;
  +  &lt;/jx:otherwise&gt;
  +&lt;/jx:choose&gt;
   </source>
    <p/>
   </s2>
  @@ -184,15 +184,15 @@
   <p>The <code>out</code> tag evaluates an expression and outputs 
   the result of the evaluation:</p>
   <source>
  -&lt;out value="Expression"/&gt;
  +&lt;jx:out value="Expression"/&gt;
   </source>
   <p>Jexl Example:</p>
   <source>
  -&lt;out value="${cart.numberOfItems}"&gt;
  +&lt;jx:out value="${cart.numberOfItems}"&gt;
   </source>
   <p>JXPath Example:</p>
   <source>
  -&lt;out value="#{cart/numberOfItems}"&gt;
  +&lt;jx:out value="#{cart/numberOfItems}"&gt;
   </source>
    <p/>
   </s2>
  @@ -200,9 +200,9 @@
   <p>The <code>forEach</code> tag allows you to iterate over a collection 
   of objects:</p>
   <source>
  -  &lt;forEach [var="Name"] [items="Expression"] [begin="NumExpr"] 
[end="NumExpr"] [step="NumExpr"]&gt;
  -    body
  - &lt;/forEach&gt;
  +&lt;jx:forEach [var="Name"] [items="Expression"] [begin="NumExpr"] 
[end="NumExpr"] [step="NumExpr"]&gt;
  +  body
  +&lt;/jx: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, ...). 
  @@ -212,24 +212,24 @@
   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>An alternate form of <code>forEach</code> is supported for convenience 
when using XPath (since you can specify the selection criteria for the 
collection using XPath itself):</p>
   <source>
  -&lt;forEach select="XPathExpression"&gt;
  +&lt;jx:forEach select="XPathExpression"&gt;
     body
  -&lt;/forEach&gt;
  +&lt;/jx:forEach&gt;
   </source>
   <p>When using XPath expressions within <code>forEach</code> the current 
element is the context node and can be referenced with: 
   <code>#{.}</code></p>
   <p>Jexl Example:</p>
   <source>
  -&lt;forEach var="item" items="${cart.cartItems} begin="${start}" 
end="${count-start}" step="1""&gt;
  +&lt;jx:forEach var="item" items="${cart.cartItems} begin="${start}" 
end="${count-start}" step="1""&gt;
      &lt;td&gt;${item.productId}&lt;/td&gt;
  -&lt;/forEach&gt;
  +&lt;/jx:forEach&gt;
   </source>
    <p/>
   <p>JXPath Example:</p>
   <source>
  -&lt;forEach select="#{cart/cartItems[position() &amp;lt;= $count]}}&gt;
  +&lt;jx:forEach select="#{cart/cartItems[position() &amp;lt;= $count]}}&gt;
      &lt;td&gt;#{./productId}&lt;/td&gt;
  -&lt;/forEach&gt;
  +&lt;/jx:forEach&gt;
   </source>
    <p/>
   </s2>
  @@ -238,7 +238,7 @@
   The <code>formatNumber</code> tag is used to display numeric data, including 
currencies and percentages, in a locale-specific manner. It 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"
  +&lt;jx:formatNumber value="Expression"
       [type="Type"] [pattern="Expression"]
       [currencyCode="Expression"] [currencySymbol="Expression"]
       [maxIntegerDigits="Expression"] [minIntegerDigits="Expression"]
  @@ -269,9 +269,9 @@
   <s2 title="formatDate">
   <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;
  +&lt;jx:formatDate value="Expression" [dateStyle="Style"] 
  +  [timeStyle="Style"] [pattern="Expression"] [type="Type"] [var="Name"] 
  +  [locale="Expression"]&gt;
   </source>
   <p>
   Only the value attribute is required. Its value should be an instance of the 
<code>java.util.Date</code> class, specifying the date and/or time data to be 
formatted and displayed.</p>
  @@ -292,29 +292,29 @@
   </s2>
   <s2 title="macro"> 
   <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;*
  +&lt;jx:macro name="Name" [targetNamespace="Namespace"]&gt;
  +  &lt;jx:parameter name="Name" [optional="Boolean"] [default="Value"]/&gt;*
     body
  -&lt;/macro&gt;
  +&lt;/jx:macro&gt;
   </source>
    <p> For example:</p><source>
  -&lt;c:macro name="d"&gt;
  +&lt;jx:macro name="d"&gt;
     &lt;tr&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;
  -&lt;/c:macro&gt;
  +&lt;/jx: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;
  +&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;jx:macro name="tablerows"&gt;
  +  &lt;jx:parameter name="list"/&gt;
  +  &lt;jx:parameter name="color"/&gt;
  +  &lt;jx: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;
  +  &lt;/jx:forEach&gt;
  +&lt;/jx: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"];
  
  
  

Reply via email to