Table of Contents
For an overview of the basic structure of a DocBook article, please see the [ http://help.unc.edu/?id=4765#basic ] Basic Document Structure section of the [ http://help.unc.edu/?id=4765 ] DocBook Styleguide . This document will cover in detail how to create Q&A sets in DocBook XML. Q&A sets are useful for collecting related FAQs into a single document.
A Q&A set occurs within a
section element. A recommended document structure might include three sections: a section describing what these Q&As are about, the collection of Q&As, and a final section directing the user to more information. The basic outline of a Q&A set following these guidelines would look similar to
Example 1, “Overview of Q&A set”. The structure of the
qandaset element has been elided in this example and is explained in detail further below.
Example 1. Overview of Q&A set
<article>
<title>Article title</title>
<section>
<title>Introduction</title>
<para>Some introductory material</para>
</section>
<section>
<title>FAQs</title>
<qandaset defaultlabel="qanda">
...
</qandaset>
</section>
<section>
<title>More Information</title>
<para>Go here for more information</para>
</section>
</article>
A Q&A set consists of four elements:
qandaset ,
qandaentry ,
question and
answer . In addition, the
qandaset element takes an attribute called
defaultlabel , which will most often have the value
qanda . The following example illustrates how a Q&A set is structured in DocBook:
Example 2. Detailed example of Q&A set
<qandaset defaultlabel="qanda">
<qandaentry>
<question>
<para>Question goes here.</para>
</question>
<answer>
<para>That's not a question.</para>
</answer>
</qandaentry>
<qandaentry>
<question>
<para>Am I a question?</para>
</question>
<answer>
<para>Yes!</para>
</answer>
</qandaentry>
</qandaset>
Note
Make sure that the text of your questions and answers are wrapped in
para tags.
The example above would be rendered like:
-
The [ http://help.unc.edu/?id=4765 ] DocBook Styleguide provides an overview of the most commonly used DocBook elements.
-
The [ http://help.unc.edu/?id= ] [ http://www.docbook.org/tdg/en/html/qandaset.html ] definition of the qandaset element from the official DocBook Element reference provides a more detailed explanation of Q&A sets and their usage.


