The arc:first keyword is used to execute a section of a script for only the first iteration of an arc:call or arc:enum keyword. It is a convenient way to generate headings or to inspect the first item of a feed before going through the rest of the feed.
During the first iteration, the arc:first body executes before any other code within the arc:call or arc:enum, regardless of where the arc:first is located within the arc:call or arc:enum body. As a reminder of this, it is recommended to locate the arc:first at the top of the arc:call or arc:enum body.
If the scope has no items, then neither arc:first nor arc:last are executed.
Create an HTML table from a feed where each item is represented as a row:
<arc:call op="listCustomers"> <arc:first> <table> <thead> <arc:enum item="customer"> <td>[_attr]</td> </arc:enum> </thead> </arc:first> <tr> <arc:enum item="customer"> <td>[_value]</td> </arc:enum> </tr> <arc:last> </table> </arc:last> </arc:call>
- arc:last: Execute a code block only for the last iteration.