Creating QandA Sets in DocBook XML


 Introduction

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.

 Document Organization

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>

 The Elements

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:

Q: Question goes here.
Q: Am I a question?
 Q:

Question goes here.

A:

That's not a question.

 
 Q:

Am I a question?

A:

Yes!

 

 Additional References

  • 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.

Copyright 2002-2007 The University of North Carolina at Chapel Hill.

Creative Commons License
This work is licensed under a Creative Commons Attribution 3.0 United States License.

Post a Comment

This form is for document feedback. If you need technical assistance, and are affiliated with UNC-Chapel Hill, please Submit a Help Request
Optional
Optional
So that we may contact you.
Do not fill out this form, this is a spam trap.
Top
University of North Carolina - Chapel Hill