<htmlxmlns="http://www.w3.org/1999/xhtml"xmlns:ev="http://www.w3.org/2001/xml-events"xmlns:xhtml="http://www.w3.org/1999/xhtml"xmlns:xxforms="http://orbeon.org/oxf/xml/xforms"xmlns:xforms="http://www.w3.org/2002/xforms"><head><title>XForms tip: how to dispatch events to all iterations of repeated controls</title><xforms:model><xforms:instancexmlns=""><values><value/><value/><value/><value/></values></xforms:instance></xforms:model></head><body><!-- Iterate over all the values --><xforms:repeatnodeset="value"id="my-repeat"><div><xforms:inputid="my-input"ref="."><!-- Upon receiving event "my-event", set the value of the control --><xforms:setvalueev:event="my-event"ref="."value="count(preceding-sibling::*) + 1"/></xforms:input></div></xforms:repeat><xforms:trigger><xforms:label>Dispatch</xforms:label><xforms:actionev:event="DOMActivate"><!-- Save current index --><xxforms:variablename="initial-index"select="index('my-repeat')"/><!-- Iterate through all values --><xforms:actionxxforms:iterate="value"><!-- Set index and dispatch event --><xforms:setindexrepeat="my-repeat"index="count(preceding-sibling::*) + 1"/><xforms:dispatchname="my-event"targetid="my-input"/></xforms:action><!-- Restore index --><xforms:setindexrepeat="my-repeat"index="$initial-index"/></xforms:action></xforms:trigger></body></html>