だから私はこのようなテーブルを記述するXML文書を持っています
<Section Columns="1" Id="2" Name="DataTable">
<DataTable Name="TestDataTable">
<DisplayOptions Column="1" />
<TableOptions Appendable="true" />
<Header Name="tableHeader">
<Label isCurrency="false">Unit</Label>
<Label isCurrency="false">type</Label>
<Label isCurrency="false">Min</Label>
<Label isCurrency="false">Max</Label>
.... more label for the header
</Header>
<Row>
<Label>A unit</Label>
<DataField Id="312" Name="unit1" ControlType="Text">
<FieldOptions Visibility="true" isCurrency="false"/>
</DataField>
.... more datafield
</Row>
... more rows
<footer name="tableFooter">
<Label>Total # of Units:</Label>
<Label>0</Label>
... more label
</footer>
次のように、その XML を使用して HTML を使用してテーブルを作成する XSLT スタイルシート。
<xsl:template match="Header">
<thead>
<xsl:for-each select="Label">
<th class="dataTableHeader">
<xsl:variable name="currentPosition" select="position() - 1"/>
<label>
<xsl:value-of select="self::node()"/>
</label>
</th>
</xsl:for-each>
</thead>
</xsl:template>
<xsl:template match="footer">
<tfoot>
<tr>
<xsl:for-each select="Label">
<th class="dataTableFooter">
<xsl:variable name="currentPosition" select="position() - 1"/>
<label name="Silly">
<xsl:value-of select="self::node()"/>
</label>
</th>
</xsl:for-each>
</tr>
</tfoot>
</xsl:template>
<xsl:template match="Row">
<tr class="tableRow">
<!-- apply the template flag if it is there -->
<xsl:if test="@Template = 'true'">
<xsl:attribute name="data-is-template" />
</xsl:if>
<!-- there should only be one label in each row -->
<xsl:if test="Label">
<td class="dataTableRowTitle">
<label for="{DataField[1]/@Id}">
<xsl:value-of select="Label"/>
</label>
</td>
</xsl:if>
<!-- apply the datafield templates in table mode -->
<xsl:apply-templates select="DataField" mode="tableInput" />
</tr>
</xsl:template>
<xsl:template match="Label">
<xsl:value-of select="self::text()"/>
</xsl:template>
問題は、XSLT が tfooter を分離するのではなく、tbody の行としてレンダリングしていることです。html を確認したところ、tfooter は tbody の子です。これは Firefox でのみ発生します。他のすべての主要なブラウザでうまく機能します。
<td colspan="2">
<table class="dataTable">
<thead>...</thead>
<tbody>
<tr class="tableRow"></tr>
<tr class="tableRow"></tr>
<tr class="tableRow"></tr>
<tr class="tableRow"></tr>
<tfoot>...</tfoot>
</tbody>
</table>
</td>
他のブラウザをチェックすると、tfooter が tbody と theader の兄弟であることがわかりました。
<td colspan="2">
<table class="dataTable">
<thead>...</thead>
<tbody>
<tr class="tableRow"></tr>
<tr class="tableRow"></tr>
<tr class="tableRow"></tr>
<tr class="tableRow"></tr>
</tbody>
<tfoot>...</tfoot>
</table>
</td>
そこで、XML のフッター部分をヘッダーと行の間に移動したところ、機能するようになりました。tfooter は現在、tbody と theader の兄弟であり、tbody の前にあります。
<td colspan="2">
<table class="dataTable">
<thead>...</thead>
<tfoot>...</tfoot>
<tbody>
<tr class="tableRow"></tr>
<tr class="tableRow"></tr>
<tr class="tableRow"></tr>
<tr class="tableRow"></tr>
</tbody>
</table>
</td>
問題は、なぜ Firefox がそれを行ったのかということです。それはバグですか、それとも Firefox がテーブルを作成するときに行の前にヘッダーとフッターを最初にレンダリングするので、XSLT でヘッダーとフッターを最初に処理する必要がありますか?