coliver 2003/12/09 18:16:07
Modified: src/documentation/xdocs/userdocs/flow jxtemplate.xml
Log:
Documented varStatus attribute of forEach
Revision Changes Path
1.23 +79 -1
cocoon-2.1/src/documentation/xdocs/userdocs/flow/jxtemplate.xml
Index: jxtemplate.xml
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/documentation/xdocs/userdocs/flow/jxtemplate.xml,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- jxtemplate.xml 10 Dec 2003 01:57:09 -0000 1.22
+++ jxtemplate.xml 10 Dec 2003 02:16:07 -0000 1.23
@@ -218,7 +218,8 @@
<p>The <code>forEach</code> tag allows you to iterate over a collection
of objects:</p>
<source>
-<jx:forEach [var="Name"] [items="Expression"] [begin="NumExpr"]
[end="NumExpr"] [step="NumExpr"]>
+<jx:forEach [var="Name"] [varStatus="Name"] [items="Expression"]
+ [begin="NumExpr"] [end="NumExpr"] [step="NumExpr"]>
body
</jx:forEach>
</source>
@@ -228,6 +229,83 @@
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>
+If the <code>varStatus</code> attribute is present a variable will be
created to hold information about the current loop status. The variable named
by the <code>varStatus</code> attribute will hold a reference to an object with
the following properties:
+ <table>
+ <tr>
+ <td>
+ Property:
+ </td>
+ <td>
+ Description:
+ </td>
+ </tr>
+ <tr>
+ <td>
+ current
+ </td>
+ <td>
+ The item from the collection for the current round of iteration
+ </td>
+ </tr>
+ <tr>
+ <td>
+ index
+ </td>
+ <td>
+ The zero-based index for the current round of iteration
+ </td>
+ </tr>
+ <tr>
+ <td>
+ count
+ </td>
+ <td>
+ The one-based count for the current round of iteration
+ </td>
+ </tr>
+ <tr>
+ <td>
+ first
+ </td>
+ <td>
+ True if this is the first round of iteration
+ </td>
+ </tr>
+ <tr>
+ <td>
+ last
+ </td>
+ <td>
+ True if this is the last round of iteration
+ </td>
+ </tr>
+ <tr>
+ <td>
+ begin
+ </td>
+ <td>
+ The value of the <code>begin</code> attribute
+ </td>
+ </tr>
+ <tr>
+ <td>
+ end
+ </td>
+ <td>
+ The value of the <code>end</code> attribute
+ </td>
+ </tr>
+ <tr>
+ <td>
+ step
+ </td>
+ <td>
+ The value of the <code>step</code> attribute
+ </td>
+ </tr>
+ </table>
+</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>
<jx:forEach select="XPathExpression">