对于我正在使用的表的默认项目,将border-collapse 属性设置为折叠,本质上,我正在寻找的结果将使表行更靠近
<table class="otherClasses compact" cols="3">
<thead class="left">
<tr><td>
<p>Header 1</p>
</td>
<td>
<p>Header 2</p>
</td>
</tr>
</thead>
<tbody class="left">
<tr>
<td>
<p>Cell 1</p>
</td>
<td>
<p>Cell 2</p>
</td>
</tr>
<tr>
<td>
<p>Cell 3</p>
</td>
<td>
<p>Cell 4</p>
</td>
</tr>
</tbody>
</table>
随着我的样式表沸腾成这样
<fo:table-and-caption margin-left="0pt" border-collapse='collapse'>
<xsl:if test="contains(@class, 'compact')">
<xsl:attribute name="border-collapse">separate</xsl:attribute>
<xsl:attribute name="border-spacing">0pt -4pt</xsl:attribute>
</xsl:if>
<fo:table>
<fo:table-header>
<xsl:apply-templates select="tr[th]"/>
</fo:table-header>
<fo:table-body>
<xsl:apply-templates select="tr[td]"/>
</fo:table-body>
</fo:table>
</fo:table-and-caption>
因此,上图显示了我使用 compact 类时与不使用时的渲染结果。老实说,我真的不知道为什么这会破坏标题行的样式,当查看边框折叠分离与折叠时,我真的认为分离对于一般情况来说是更好的设置,但它在这种情况下,似乎对我造成了破坏
针对我的具体问题的解决方案我最终选择了一条不同的路线并保留了边框折叠属性。我最终调整了填充以达到我想要的效果。