1
"tr"요소 내부에서 "td"요소의 개수를 사용하여 요소에 대한 속성 밸브를 추가하고 싶습니다. 테이블의 "td"요소를 사용하여 cols 번호를 수정해야합니다.
내 입력 XML :<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
<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>
예상 출력은 다음과 같은 :
<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>
"tr"내부의 "td"수를 사용하여 cols 값이 필요합니다. 단일 "td"가 cols = "1"을 의미하고 "tr"을 사용하여 여러 "td"의 수에 따라 달라지는 경우
코딩을 제안하십시오. 사전에 다시 한번 감사
감사 @Rupesh. 잘 작동한다. – User501