DocBook supports sets of questions and answers, such as Frequently Asked QUestions (FAQ) documents.
The top-level element for a set of questions and answers
is qandaset. Here is a very simple set of
two Q&A pairs:
| Q: | What is your favorite color? |
| A: | Blue. |
| Q: | What is the air-speed velocity of an unladen swallow? |
| A: | What do you mean? An African or European swallow? |
Here's how that list is encoded:
<qandaset defaultlabel='qanda'>
<title>At the Bridge of Death</title>
<qandaentry>
<question>
<para>
What is your favorite color?
</para>
</question>
<answer>
<para>
Blue.
</para>
</answer>
</qandaentry>
<qandaentry>
<question>
<para>
What is the air-speed velocity of an unladen swallow?
</para>
</question>
<answer>
<para>
What do you mean? An African or European swallow?
</para>
</answer>
</qandaentry>
</qandaset>
To specify the format, in the qandaset
element, include a defaultlabel
attribute with one of these values:
defaultlabel='qanda'
| Label the questions with “Q:” and the answers with “A:”. |
defaultlabel='number'
| Number the entries. |
defaultlabel='label'
|
Each question element and each
answer element must have a
label attribute containing the
string to be used as a label.
|
For a simple list of questions and answers, enclose
each item in a qandaentry element.
Inside the qandaentry, enclose each
question in a question element and
each answer in an answer element.
You can have any number of question
elements in a qandaentry element.
You can have any number of answer
elements in a qandaentry element,
even none at all (for questions with no answer).
If you want to structure your Q&A set into sections,
you can use a qandadiv element inside your
qandaset element, with one or more qandaentry elements inside that.
To give the section a title, use a title
element after the qandadiv element.
Here's a partial example:
<qandaset defaultlabel='qanda'>
<title>Frequently axed questors</title>
<qandadiv>
<title>Trolls I have put down</title>
<qandaentry>
...
</qandaentry>
...
</qandadiv>
<qandadiv>
<title>Castle Anthrax</title>
<qandaentry>
...
</qandaentry>
...
</qandadiv>
</qandaset>
You can even use qandadiv elements inside
other qandadiv elements to divide your
list into sublists, sub-sublists, and so on.