我想填充我的XML文件的内容和XForm重复部分。 首先,我需要根据XML文件的以下记录创建行:
<Entity code="a" type="AdditionalServices" active="true" sortOrder="1">
<Description language="de">a</Description>
<Description language="en">a</Description>
</Entity>
<Entity code="b" type="AdditionalServices" active="true" sortOrder="2">
<Description language="de">b</Description>
<Description language="en">b</Description>
</Entity>
<Entity code="c" type="AdditionalServices" active="true" sortOrder="3">
<Description language="de">c</Description>
<Description language="en">c</Description>
</Entity>
<Entity code="d" type="AdditionalServices" active="true" sortOrder="4">
<Description language="de">d</Description>
<Description language="en">d</Description>
</Entity>
<Entity code="e" type="AdditionalServices" active="true" sortOrder="5">
<Description language="de">e</Description>
<Description language="en">e</Description>
</Entity>
<Entity code="f" type="AdditionalServices" active="true" sortOrder="6">
<Description language="de">f</Description>
<Description language="en">f</Description>
</Entity>
我可以用以下方法完成:
<fr:grid>
<xh:table >
<xh:thead>
<xh:tr>
<xh:th>Code</xh:th>
</xh:tr>
</xh:thead>
<xh:tbody >
<xf:repeat ref="instance('fr-form-instance')//Entity[@type='AdditionalServices']" appearance="full">
<xh:tr>
<xh:td>
<xf:input ref="@code"></xf:input>
</xh:td>
</xf:repeat>
</xh:tbody>
</xh:table>
</fr:grid>
然后显示存储在以下XML部分中的数量:
<CalcAdditionalServices>
<AdditionalServicesCode>d</AdditionalServicesCode>
<Quantity>1</Quantity>
</CalcAdditionalServices>
<CalcAdditionalServices>
<AdditionalServicesCode>e</AdditionalServicesCode>
<Quantity>2</Quantity>
</CalcAdditionalServices>
我的代码如下:
<xh:td>
<xf:input ref="instance('fr-form-instance')//CalcAdditionalServices[AdditionalServicesCode/text()=current()/@code]//Quantity"></xf:input>
</xh:td>
我只得到第一个数量:
Code Qty
a
b
c
d 1
e
f
我没有那么多使用XForms的经验,所以如果有人能给我一个提示会很棒。
答案 0 :(得分:0)
系统未创建第二个节点。
<CalcAdditionalServices>
<AdditionalServicesCode>e</AdditionalServicesCode>
<Quantity>2</Quantity>
</CalcAdditionalServices>
我们更改了替换方法,现在一切都很好。