Cell spacing and cell padding

The stylesheets provide some control over cell spacing (extra space between table cells, visible as space between cell borders if they are turned on), and cell padding (extra space between the cell border and cell content).

For HTML output, you can specify values for the HTML attributes cellspacing (space between cell borders) and cellpadding (space between cell content and cell border) in two ways. You can set values for these globally for all tables in the document by setting the html.cellspacing and html.cellpadding stylesheet parameters, respectively.

To set values for an individual table in HTML output, you use processing instructions inside the tgroup element. For example:

<table><title>My table</title>
<?dbhtml cellspacing="0" ?>
<?dbhtml cellpadding="2" ?>

This example makes sure the cellspacing is zero and the cellpadding is 2 pixels for this table, possibly overriding the global values set by the parameters. In HTML, cell padding applies to both the top and bottom as well as the left and right of the cell.

For FO output, you can specify the cell padding but not the cell spacing. But you can specify the cell padding for each direction in the cell. If you want to set cell padding values globally for all tables in the document, then copy the attribute-set named table.cell.padding from fo/param.xsl to your customization layer and change the values. The following is an example showing the default values for FO output.

<xsl:attribute-set name="table.cell.padding">
  <xsl:attribute name="padding-left">2pt</xsl:attribute>
  <xsl:attribute name="padding-right">2pt</xsl:attribute>
  <xsl:attribute name="padding-top">2pt</xsl:attribute>
  <xsl:attribute name="padding-bottom">2pt</xsl:attribute>

As you can see, you specify separate values for top, bottom, left, and right padding in the cell. At this time, you cannot set the padding values for individual tables for FO output.