1
"tr"要素内で "td"要素のカウントを使用して要素の属性バルブを追加します。テーブルの "td"要素を使用して列番号を修正する必要があります
私の入力XML:
<table>
<tgroup cols="2">
<tbody>
<row>
<entry>
<p>Type</p>
</entry>
<entry>
<p>Risk</p>
</entry>
</row>
<row>
<entry>
<p>Fundic</p>
</entry>
<entry>
<p>Low</p>
</entry>
</row>
</tbody>
</tgroup>
</table>
:予想される出力は次のようになり
<table>
<tgroup>
<tbody>
<row>
<entry>
<p>Type</p>
</entry>
<entry>
<p>Risk</p>
</entry>
</row>
<row>
<entry>
<p>Fundic</p>
</entry>
<entry>
<p>Low</p>
</entry>
</row>
</tbody>
</tgroup>
</table>
:として
<xsl:template match="table">
<table>
<xsl:if test="@title">
<title><xsl:value-of select="@title"/></title>
</xsl:if>
<tgroup>
<xsl:apply-templates/>
</tgroup>
</table>
</xsl:template>
<xsl:template match="tbody">
<tbody>
<xsl:apply-templates/>
</tbody>
</xsl:template>
<xsl:template match="th | tr">
<row>
<xsl:apply-templates/>
</row>
</xsl:template>
<xsl:template match="td">
<entry>
<xsl:if test="@align">
<xsl:attribute name="align"><xsl:value-of select="@align"/></xsl:attribute>
</xsl:if>
<xsl:if test="@valign">
<xsl:attribute name="valign"><xsl:value-of select="@valign"/></xsl:attribute>
</xsl:if>
<xsl:apply-templates/>
</entry>
</xsl:template>
私は取得しています出力を:私はとして使用
<table>
<tbody>
<tr>
<td>
<p>Type</p>
</td>
<td>
<p>Risk</p>
</td>
</tr>
<tr>
<td>
<p>Fundic</p>
</td>
<td>
<p>Low</p>
</td>
</tr>
</tbody>
</table>
XSL
"tr"の内部で "td"のカウントを使用してcols値が必要です。単一の "td"がcols = "1"を意味し、 "tr"の内部で使用する複数の "td"の数に依存する場合
これをコーディングしてください。事前のおかげで
おかげで再び@Rupesh。その実用的な罰金 – User501