Q and A formatting

For HTML output, the stylesheets use an HTML TABLE element to lay out the question and answer text and their labels. Each qandaentry takes up two rows, one for the question and one for the answer. It is a two-column table with the labels in the left column and the question and answer text in the right column.

HTML tables do a good job of automatically adjusting their column widths to fit their text, but you may want finer control. There are certain features of the Q and A table formatting that you can control using processing instructions embedded in your document. For example:

<qandaset>  1
<?dbhtml label-width="10%" ?>  2
<?dbhtml toc="1" ?>  3
<?dbhtml cellspacing="3px" cellpadding="3px" ?> 4
  <qandaentry>
    <question>Left button</question>
    <answer><para>Blah blah</para></answer>
  </qandaentry>
  ...
</qandaset>

1

Put the processing instructions somewhere inside the qandaset element. You can put them all into one PI, or make separate PIs for each.

2

This PI sets the table left column minimum width, which is the space used for the labels. Use percentages for the values. The default is 1%, but the HTML browser will widen that to fit the labels used in the table.

3

You can generate a table of contents for this qandaset by setting toc to nonzero in the processing instruction. This produces a list of questions that appears before the first question.

4

You can adjust the HTML table cell spacing and padding with these values.

If you need more control in HTML output, then you can customize the template named process.qandaset in html/qandaset.xsl. That template creates the layout table and generates the rows.

For FO output, a qandaset is processed as an fo:list-block in a manner similar to a variablelist. The labels are processed into fo:list-item-label elements, and the question and answer text as list-item-body elements. The width allocated for the labels is automatically calculated by the stylesheet. Or you can use a dbfo label-width processing instruction to manually adjust the width for a given qandaset. Use it like the dbhtml processing instruction described above.

For print output, the stylesheets provide the following attribute-sets for customizing titles in qandaset and qandadiv elements.

qanda.title.properties         General properties for all levels
qanda.title.level1.properties  Properties specific to each level
qanda.title.level2.properties
qanda.title.level3.properties
qanda.title.level4.properties
qanda.title.level5.properties

These attribute sets are nearly identical to the section.title.properties attribute-sets. See the section “Section titles” for examples of how to customize such attribute-sets. The main difference with these attribute-sets is that the level is used somewhat differently. A qandaset is contained within a section, so its title level is considered one below its container section level in the hierarchy. So a qandaset within a sect1 would be treated as level 2 for its title. Any qandadiv elements inside it would have their titles treated as level 3. If you prefer that all your qandaset titles be the same size regardless of their location within a section hierarchy, then you need to set that font size in each of attribute-sets with level in their name.

By default, qandadiv elements have numbered titles. You can set the qandadiv.autolabel parameter to zero to turn off the numbering of the qandadiv titles.