The if attribute

The if attribute indicates that an action block should only be executed if the XPath expression used evaluates to true().

For example, if our application was looping through a list of RSS feeds to process, once it reaches the end of the list we would set the feed counter back to 1 and save any new items we had read.

The following mark-up tests for a loop counter to be greater than the count of the number of RSS feeds to process, and when it is, it resets the counter and invokes a submission:

<xf:action if="@i &gt; count(feed)">
  <xf:setvalue ref="@i" value="1" />
  <xf:send submission="sub-put-unread-items" />
</xf:action>

For more information and further examples see Section 3.4 of XForms 1.1.