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>
--- <if test="XPathExpression">
+++ <pre><if test="XPathExpression">
body
</if>
</pre>
<p>Example:</p>
--- <pre>
--- <jpath:if test="cart/numberOfItems = 0">
+++ <pre><jpath:if test="cart/numberOfItems = 0">
Your cart is empty
</jpath:if>
</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>
--- <choose>
+++ <pre><choose>
<when test="XPathExpression">
body
</when>+
(5 equal lines skipped)
<p>Example:</p>
--- <pre>
--- <choose>
+++ <pre><choose>
<when test="not(user/loggedIn)">
You're not logged in
</when>
(8 equal lines skipped)
<p>The <tt>value-of</tt> tag evaluates an expression and outputs the result of
the evaluation:</p>
--- <pre>
--- <value-of select="XPathExpression"/>
+++ <pre><value-of select="XPathExpression"/>
</pre>
<p>Example:</p>
--- <pre>
--- <value-of select="cart/numberOfItems">
+++ <pre><value-of select="cart/numberOfItems">
</pre>
<h2>for-each</h2>
<p>The <tt>for-each</tt> tag allows you to iterate over a collection of objects:
</p>
--- <pre>
--- <for-each select="XPathExpression">
+++ <pre><for-each select="XPathExpression">
body
</for-each>
</pre>
(5 equal lines skipped)
<p>Example:</p>
--- <pre>
--- <for-each select="cart/cartItems[position() <= $count]">
+++ <pre><for-each select="cart/cartItems[position() <= $count]">
<td><value-of select="./productId"></td>
</for-each>
</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>
--- <continuation [level="Number"]/>
+++ <pre><continuation [level="Number"]/>
</pre>
<p>Example:</p>
--- <pre>
--- <xsp:attribute name="action"><xsp:expr><jpath:continuation/>+".form"</xsp:expr></xsp:attribute>
+++ <pre><xsp:attribute name="action"><xsp:expr><jpath:continuation/>+".form"</xsp:expr></xsp:attribute>
</pre>
<h2>set-lenient</h2>
(9 equal lines skipped)
elements, otherwise it is a global setting. You can't nest
<jpath:set-lenient> tags.</p>
--- <pre>
--- <jpath:set-lenient lenient="true|false">
+++ <pre> <jpath:set-lenient lenient="true|false">
</pre>
<p>Example:</p>
--- <pre>
--- <jpath:set-lenient lenient="true">
+++ <pre> <jpath:set-lenient lenient="true">
</pre>
</body>
(1 equal lines skipped)
Fields
======
no changes
Links
=====
no changes
Custom Fields
=============
no changes
Collections
===========
no changes