The rsb:first keyword is used to execute a section of a script for only the first iteration of an rsb:call or rsb: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 rsb:first body executes before any other code within the rsb:call or rsb:enum, regardless of where the rsb:first is located within the rsb:call or rsb:enum body. It is a good practice to locate the rsb:first at the top of the rsb:call or rsb:enum body as a reminder of this behavior.
- This keyword does not have any parameters.
- This keyword does not have any control attribute.
The following example creates an HTML table from a feed where each item is represented as a row.
<rsb:call op="listCustomers"> <rsb:first> <table> <thead> <rsb:enum item="customer"> <td>[_attr]</td> </rsb:enum> </thead> </rsb:first> <tr> <rsb:enum item="customer"> <td>[_value]</td> </rsb:enum> </tr> <rsb:last> </table> </rsb:last> </rsb:call>
- rsb:last: To learn how to include a block of keywords that are executed after all the items have been executed, and only if rsb:first was executed.