I working on a search application using XForms standards. the applications searches a small xml file that contains students data. I've written the queries using XQuery and I've tried them out. queries results are fine, very fine. but when I connect them using XForms with the instance and submissions, the presentation layer(a xf:repeat table, each raw is a student) doesn't get updated at all. I know that the queries are valid. the presentation is good but I'm not sure. My question could please help me make a working copy of this application.
the Model is as follow
<xf:model>
<xf:action ev:event="xforms-ready">
<xf:send submission="load-data"/>
</xf:action>
<xf:instance xmlns="" id="studInstance">
<students>
<student>
<idStudent/>
<Name/>
<LastName/>
<Address/>
</student>
</students>
</xf:instance>
<xf:instance xmlns="" id="search">
<parameters>
<query/>
<field>Name</field>
</parameters>
</xf:instance>
<xf:submission id="load-data" method="get" serialization="none" action="modules/load.xql" replace="instance" instance="studInstance">
<xf:message ev:event="xforms-submit-error" level="ephemeral">Load operation failed </xf:message>
<xf:message ev:event="xforms-submit-done" level="ephemeral">Load operation Succeeded </xf:message>
</xf:submission>
<xf:submission id="search" action="modules/search.xql" method="post" serialization="none" ref="instance('search')" targetref="instance('studInstance')" replace="instance">
<xf:message ev:event="xforms-submit-error" level="ephemeral">Search operation failed </xf:message>
</xf:submission>
</xf:model>
the result would be bind-ed to repeat section here:
<xf:group>
<xf:repeat instance="studInstance" nodeset="/students/student">
<tr>
<td>
<xf:output ref="idStudent"/>
</td>
<td>
<xf:output ref="Name"/>
</td>
<td>
<xf:output ref="LastName"/>
</td>
<td>
<xf:output ref="Address"/>
</td>
</tr>
</xf:repeat>
</xf:group>
So what's wrong with this code!
The attribute
instancehas no meaning in a xf:repeat. The correct way of doing what you want is using theinstancefunction inside your XPath: