我使用XForms标准处理搜索应用程序。应用程序搜索包含学生数据的小xml文件。我已经使用XQuery编写了查询,并且我已经尝试过了。查询结果很好,很好。但是当我使用XForms将它们与实例和提交连接起来时,表示层(xf:重复表,每个raw都是学生)根本没有更新。 我知道查询是有效的。演示文稿很好,但我不确定。 我的问题可以帮助我制作一份这个应用程序的工作副本。
模型如下
<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>
结果将绑定到此处重复部分:
<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>
这个代码有什么问题!
答案 0 :(得分:0)
属性instance
在xf:repeat中没有意义。正确的做法是使用XPath中的instance
函数:
<xf:repeat nodeset="instance(studInstance)/student">