XForms を使用して、XML-DB eXist-db をバックエンドとして使用する Web アプリケーションを構築しています。eXist は XForms コードを HTML と JavaScript に変換します。
まず、2 つのインスタンスを取得しました。
<xf:instance xmlns="" id="results">
<result>
<ServiceDefinition>
<InventoryLabel LastChange="2012-01-24">SVC380712435</InventoryLabel>
<SystemName IPaddress="111.222.333.123">XXX</SystemName>
<Service ServiceCategory="Internetservice">Web-Server</Service>
<OSClass OperatingSystem="CentOS">UNIX</OSClass>
<SystemType Manufacturer="VMware">VM</SystemType>
<Backup/>
<Location SystemContact="Max Power" AdminGroup="power">N22</Location>
</ServiceDefinition>
....
</result>
</xf:instance>
<xf:instance xmlns="" id="domain">
<system name="XXX">
<NIC MAC="00-50-56-ae-00-3c"
time="1329167846" missed="1323350247" state="inactive"
IP="111.222.333.123" LAN="Test"/>
</system>
...
</xf:instance>
「結果」インスタンスのxf:repeat
すべての要素を反復処理するために使用するテーブルを作成したいと考えています。<ServiceDefinition>
すべての行には、「ドメイン」インスタンスからの関連する「状態」情報を配置する「ステータス」列が含まれています。
これはテーブルの XForms コードです。
<div class="table">
<table border="0">
<thead>
<tr>
<th class="sysName">Hostname</th>
<th class="services">Service</th>
<th class="os">OS Class</th>
<th class="location">Location</th>
<th class="link">Details</th>
<th>Status</th>
</tr>
</thead>
<tbody>
<xf:repeat nodeset="instance('results')/result/ServiceDefinition" id="link-repeat">
<tr>
<td class="sysName"><xf:output ref="SystemName" /></td>
<td>
<xf:repeat nodeset="Service" class="row">
<div>
<xf:output ref="."/>
</div>
</xf:repeat>
</td>
<td class="os"><xf:output ref="OSClass"/> </td>
<td class="location"><xf:output ref="Location" /></td>
<td class="link">
<xf:trigger submission="view-entry" appearance="minimal" class="url">
<xf:label>View</xf:label>
<xf:action ev:event="DOMActivate">
<xf:setvalue ref="instance('URL-container')"
value="concat('serviceDetails.xql?svc=', instance('results')/result/ServiceDefinition[index('link-repeat')]/InventoryLabel)"/>
<xf:load ref="instance('URL-container')" />
</xf:action>
</xf:trigger>
</td>
<td>
<xf:output ref="instance('domain')/system[@name = instance('results')/result/ServiceDefinition[index('link-repeat')]/SystemName]/NIC/@state" />
</td>
</tr>
</xf:repeat>
</tbody>
</table>
</div>
問題はこの部分のようです:
<td>
<xf:output ref="instance('domain')/system[@name = instance('results')/result/ServiceDefinition[index('link-repeat')]/SystemName]/NIC/@state" />
</td>
この表現に何か問題がありますか?繰り返しステートメントで現在のノードに一致するシステムの状態属性を取得したいと考えています。ただし、ページをロードし、「結果」インスタンスが多くのアイテムで構成されていると、Javascript エラーが発生します。
A script on this page may be busy, or it may have stopped responding. You can stop the script now, or you can continue to see if the script will complete.
Script: http://test:8080/exist/xforms/xsltforms/xsltforms.js:771*
行 (この場合は 771) は常に異なります。
結果のインスタンスが非常に小さい場合 (最大約 20 要素)、期待どおりに機能します。
助けや提案をいただければ幸いです。私はこれらすべてに慣れていないので、しばらくお待ちください。