Search code examples
marginpaddingdocbook

Add space between seglistitems in docbook


When rendering the following DocBook XML there is no additional space between two different seglistitem so it is quite hard to distinguish one entry from the other when reading. How can I add some spacing between the items (not between the fields of an item)?

<segmentedlist>
  <segtitle>Field 1</segtitle>
  <segtitle>Field 2</segtitle>
  <seglistitem>
    <seg>First item</seg><seg>Some data</seg>
  </seglistitem>
  <seglistitem>
    <seg>Second item</seg><seg>Some data</seg>
  </seglistitem>
</segmentedlist>

Solution

  • Using DocBook-XSL:

    HTML output

    Create a CSS file that includes a rule for the seglistitem class:

    .seglistitem {
      margin-bottom: 10px;
                 } 
    

    PDF output

    Customize the "seglistitem" template (see lists.xsl) by adding a suitable margin-bottom (or space-after) value:

    <xsl:template match="seglistitem">
      <xsl:variable name="id">
        <xsl:call-template name="object.id"/>
      </xsl:variable>
      <fo:block id="{$id}" margin-bottom="10px">
        <xsl:apply-templates/>
      </fo:block>
    </xsl:template>