title: orbeon xform repeating element issue
body: <p>I am trying to add one repeating element on the fly/run time using the add button . When i click the add button i get the error 
  "Function index uses repeat id 'employee-repeat' which is not in scope"  . I am not sure if i am referring the repeating element properly within the form. here is the complete x from .</p>
  
  <pre><code>      `&lt;xhtml:html xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
          xmlns:xxforms="http://orbeon.org/oxf/xml/xforms"
          xmlns:saxon="http://saxon.sf.net/"
          xmlns:xi="http://www.w3.org/2001/XInclude"
          xmlns:xs="http://www.w3.org/2001/XMLSchema"
          xmlns:xxi="http://orbeon.org/oxf/xml/xinclude"
          xmlns:sql="http://orbeon.org/oxf/xml/sql"
          xmlns:xforms="http://www.w3.org/2002/xforms"
          xmlns:exforms="http://www.exforms.org/exf/1-0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xmlns:xhtml="http://www.w3.org/1999/xhtml"
          xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
          xmlns:ev="http://www.w3.org/2001/xml-events"&gt;
  &lt;xhtml:head&gt;
      &lt;xhtml:title&gt;U Form&lt;/xhtml:title&gt;
      &lt;xforms:model id="fr-form-model"&gt;
         &lt;xforms:instance id="fr-form-instance"&gt;
              &lt;form&gt;
                  &lt;section-1&gt;
                      &lt;hello/&gt;
                  &lt;/section-1&gt;
              &lt;/form&gt;
          &lt;/xforms:instance&gt;
  
  
          &lt;xforms:bind id="fr-form-binds" nodeset="instance('fr-form-instance')"&gt;
              &lt;xforms:bind id="section-1-bind" nodeset="section-1"&gt;
                  &lt;xforms:bind id="hello-bind" nodeset="hello" name="hello"/&gt;
              &lt;/xforms:bind&gt;
          &lt;/xforms:bind&gt;
  
  
          &lt;xforms:instance id="fr-form-metadata" xxforms:readonly="true"&gt;
              &lt;metadata&gt;
                  &lt;application-name&gt;gvhd&lt;/application-name&gt;
                  &lt;form-name&gt;test&lt;/form-name&gt;
                  &lt;title xml:lang="en"&gt;Untitled Form&lt;/title&gt;
                  &lt;description xml:lang="en"/&gt;
                  &lt;author/&gt;
                  &lt;logo mediatype="" filename="" size=""/&gt;
              &lt;/metadata&gt;
          &lt;/xforms:instance&gt;
  
  
          &lt;xforms:instance id="fr-form-attachments"&gt;
              &lt;attachments&gt;
                  &lt;css mediatype="text/css" filename="" size=""/&gt;
                  &lt;pdf mediatype="application/pdf" filename="" size=""/&gt;
              &lt;/attachments&gt;
          &lt;/xforms:instance&gt;
  
  
          &lt;xforms:instance id="fr-form-resources" xxforms:readonly="true"&gt;
              &lt;resources&gt;
                  &lt;resource xml:lang="en"&gt;
                      &lt;section-1&gt;
                          &lt;label&gt;Section1&lt;/label&gt;
                          &lt;help/&gt;
                      &lt;/section-1&gt;
                      &lt;hello&gt;
                          &lt;label&gt;hello&lt;/label&gt;
                          &lt;hint/&gt;
                          &lt;help/&gt;
                          &lt;alert/&gt;
                      &lt;/hello&gt;
                  &lt;/resource&gt;
              &lt;/resources&gt;
          &lt;/xforms:instance&gt;
  
          &lt;xforms:instance id="employees-instance"&gt;
              &lt;employees&gt;
                  &lt;employee&gt;
                      &lt;first-name&gt;Alice&lt;/first-name&gt;
                  &lt;/employee&gt;
                  &lt;employee&gt;
                      &lt;first-name&gt;Bob&lt;/first-name&gt;
                  &lt;/employee&gt;
                  &lt;employee&gt;
                      &lt;first-name&gt;Marie&lt;/first-name&gt;
                  &lt;/employee&gt;
              &lt;/employees&gt;
          &lt;/xforms:instance&gt;
  
  
          &lt;xforms:instance id="fr-service-request-instance" xxforms:exclude-result-prefixes="#all"&gt;
              &lt;request/&gt;
          &lt;/xforms:instance&gt;
  
          &lt;xforms:instance id="fr-service-response-instance" xxforms:exclude-result-prefixes="#all"&gt;
              &lt;response/&gt;
          &lt;/xforms:instance&gt;
  
      &lt;/xforms:model&gt;
  &lt;/xhtml:head&gt;
  &lt;xhtml:body&gt;
      &lt;fr:view&gt;
          &lt;xforms:label ref="instance('fr-form-metadata')/title"/&gt;
          &lt;fr:body&gt;
              &lt;fr:section id="section-1-section" bind="section-1-bind"&gt;
                  &lt;xforms:label ref="$form-resources/section-1/label"/&gt;
                  &lt;xforms:help ref="$form-resources/section-1/help"/&gt;
                  &lt;fr:grid columns="2"&gt;
                      &lt;xforms:repeat nodeset="instance('employees-instance')/employee" id="employee-repeat"&gt;
                                &lt;xhtml:tr&gt;
                              &lt;xhtml:td&gt;
                                  &lt;xforms:output ref="first-name"/&gt;
                              &lt;/xhtml:td&gt;
                              &lt;xhtml:td&gt;
                                  &lt;xforms:output ref="first-name"/&gt;
                              &lt;/xhtml:td&gt;
                          &lt;/xhtml:tr&gt;
                                                    &lt;/xforms:repeat&gt;
                      &lt;xhtml:tr&gt;
                          &lt;xhtml:td&gt;
                              &lt;xforms:input bind="hello-bind" id="hello-control"&gt;
                                  &lt;xforms:label ref="$form-resources/hello/label"/&gt;
                                  &lt;xforms:hint ref="$form-resources/hello/hint"/&gt;
                                  &lt;xforms:help ref="$form-resources/hello/help"/&gt;
                                  &lt;xforms:alert ref="$fr-resources/detail/labels/alert"/&gt;
                              &lt;/xforms:input&gt;
                          &lt;/xhtml:td&gt;
                          &lt;xhtml:td/&gt;
                      &lt;/xhtml:tr&gt;
                      &lt;xhtml:tr&gt;
                          &lt;xhtml:td&gt;
                              &lt;xforms:trigger&gt;
                                  &lt;xforms:label&gt;Add&lt;/xforms:label&gt;
                                  &lt;xforms:insert ev:event="DOMActivate" context="instance('fr-form-instance')" nodeset="instance('employees-instance')/employee" at="index('employee-repeat')"
                                                 position="after"/&gt;
                              &lt;/xforms:trigger&gt;
                          &lt;/xhtml:td&gt;
                          &lt;xhtml:td/&gt;
                      &lt;/xhtml:tr&gt;
                  &lt;/fr:grid&gt;
              &lt;/fr:section&gt;
          &lt;/fr:body&gt;
      &lt;/fr:view&gt;
  &lt;/xhtml:body&gt;
  </code></pre>
  
  <p>`</p>