You are viewing a plain text version of this content. The canonical link for it is here.
Posted to docs@cocoon.apache.org by da...@cocoon.zones.apache.org on 2005/10/14 15:29:18 UTC

[DAISY] Updated: Advanced Control Flow - JPath

A document has been updated:

http://cocoon.zones.apache.org/daisy/legacydocs/516.html

Document ID: 516
Branch: main
Language: default
Name: Advanced Control Flow - JPath (previously Advanced Control Flow)
Document Type: Document (unchanged)
Updated on: 10/14/05 1:28:54 PM
Updated by: Helma van der Linden

A new version has been created, state: publish

Parts
=====
Content
-------
This part has been updated.
Mime type: text/xml (unchanged)
File name:  (unchanged)
Size: 3931 bytes (previous version: 3943 bytes)
Content diff:
(24 equal lines skipped)
    <p>The <tt>if</tt> tag allows the conditional execution of its body according to
    value of its <tt>test</tt> attribute:</p>
    
--- <pre>
--- &lt;if test="XPathExpression"&gt;
+++ <pre>&lt;if test="XPathExpression"&gt;
      body
    &lt;/if&gt;
         </pre>
    
    <p>Example:</p>
    
--- <pre>
--- &lt;jpath:if test="cart/numberOfItems = 0"&gt;
+++ <pre>&lt;jpath:if test="cart/numberOfItems = 0"&gt;
      Your cart is empty
    &lt;/jpath:if&gt;
         </pre>
(6 equal lines skipped)
    conditions of its nested <tt>when</tt> tags evaluate to <tt>true</tt>, then the
    body of its <tt>otherwise</tt> tag is evaluated, if present:</p>
    
--- <pre>
--- &lt;choose&gt;
+++ <pre>&lt;choose&gt;
      &lt;when test="XPathExpression"&gt;
        body
      &lt;/when&gt;+
(5 equal lines skipped)
    
    <p>Example:</p>
    
--- <pre>
--- &lt;choose&gt;
+++ <pre>&lt;choose&gt;
      &lt;when test="not(user/loggedIn)"&gt;
         You're not logged in
      &lt;/when&gt;
(8 equal lines skipped)
    <p>The <tt>value-of</tt> tag evaluates an expression and outputs the result of
    the evaluation:</p>
    
--- <pre>
--- &lt;value-of select="XPathExpression"/&gt;
+++ <pre>&lt;value-of select="XPathExpression"/&gt;
         </pre>
    
    <p>Example:</p>
    
--- <pre>
--- &lt;value-of select="cart/numberOfItems"&gt;
+++ <pre>&lt;value-of select="cart/numberOfItems"&gt;
         </pre>
    
    <h2>for-each</h2>
    
    <p>The <tt>for-each</tt> tag allows you to iterate over a collection of objects:
    </p>
    
--- <pre>
--- &lt;for-each select="XPathExpression"&gt;
+++ <pre>&lt;for-each select="XPathExpression"&gt;
      body
    &lt;/for-each&gt;
         </pre>
(5 equal lines skipped)
    
    <p>Example:</p>
    
--- <pre>
--- &lt;for-each select="cart/cartItems[position() &lt;= $count]"&gt;
+++ <pre>&lt;for-each select="cart/cartItems[position() &lt;= $count]"&gt;
       &lt;td&gt;&lt;value-of select="./productId"&gt;&lt;/td&gt;
    &lt;/for-each&gt;
         </pre>
(5 equal lines skipped)
    optional <tt>level</tt> attribute. Zero is the current level, <tt>-1</tt>
    refers to the previous continuation, and so on.</p>
    
--- <pre>
--- &lt;continuation [level="Number"]/&gt;
+++ <pre>&lt;continuation [level="Number"]/&gt;
         </pre>
    
    <p>Example:</p>
    
--- <pre>
--- &lt;xsp:attribute name="action"&gt;&lt;xsp:expr&gt;&lt;jpath:continuation/&gt;+".form"&lt;/xsp:expr&gt;&lt;/xsp:attribute&gt;
+++ <pre>&lt;xsp:attribute name="action"&gt;&lt;xsp:expr&gt;&lt;jpath:continuation/&gt;+".form"&lt;/xsp:expr&gt;&lt;/xsp:attribute&gt;
         </pre>
    
    <h2>set-lenient</h2>
(9 equal lines skipped)
    elements, otherwise it is a global setting. You can't nest
    &lt;jpath:set-lenient&gt; tags.</p>
    
--- <pre>
---         &lt;jpath:set-lenient lenient="true|false"&gt;
+++ <pre>        &lt;jpath:set-lenient lenient="true|false"&gt;
          </pre>
    
    <p>Example:</p>
    
--- <pre>
---         &lt;jpath:set-lenient lenient="true"&gt;
+++ <pre>        &lt;jpath:set-lenient lenient="true"&gt;
          </pre>
    
    </body>
(1 equal lines skipped)


Fields
======
no changes

Links
=====
no changes

Custom Fields
=============
no changes

Collections
===========
no changes