XForms/Repeat 到表格
外觀
< XForms
開發者經常希望以表格結構顯示 XML 資料。不幸的是,許多瀏覽器中使用的 HTML <table> 實現不適合修改。
為了規避這個問題,XForms 允許您將 repeat 用於表格行中的 HTML <table> 元素的屬性。因此,您無需使用 <xf:repeat> 元素,而是使用 xf:repeat-nodeset 屬性。請注意,您必須在屬性上使用xf 字首。這與通常的過程不同。
注意:此示例在 FireFox 0.6 或 0.7 擴充套件中無法執行。有關詳細資訊,請參閱 Bug 280368。

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:xf="http://www.w3.org/2002/xforms">
<head>
<title>Repeat Into Table Using xf:repeat-nodeset</title>
<!-- remove this line for non-formfaces implementations -->
<script type="text/javascript" src="formfaces.js"></script>
<xf:model>
<xf:instance xmlns="">
<Data xmlns="">
<Person>
<PersonFullName>John Doe</PersonFullName>
<ContactTelephoneID>(555) 123-4567</ContactTelephoneID>
</Person>
<Person>
<PersonFullName>Jane Smith</PersonFullName>
<ContactTelephoneID>(555) 123-4567</ContactTelephoneID>
</Person>
<Person>
<PersonFullName>Jack Jones</PersonFullName>
<ContactTelephoneID>(555) 123-4567</ContactTelephoneID>
</Person>
<Person>
<PersonFullName>Sue Smith</PersonFullName>
<ContactTelephoneID>(555) 123-4567</ContactTelephoneID>
</Person>
</Data>
</xf:instance>
</xf:model>
</head>
<body>
<table border="1">
<tr>
<th>Name</th>
<th>Telephone Number</th>
</tr>
<tbody xf:repeat-nodeset="Person">
<tr>
<td>
<xf:output ref="PersonFullName" />
</td>
<td>
<xf:output ref="ContactTelephoneID" />
</td>
</tr>
</tbody>
</table>
</body>
</html>
執行 repeat 的行是表格主體標籤
<tbody xf:repeat-nodeset="Person">