<?xml version="1.0" encoding="UTF-8"?>
<!--
  This file is part of DocBook V5.0
  
  Copyright 1992-2008 HaL Computer Systems, Inc.,
  O'Reilly & Associates, Inc., ArborText, Inc., Fujitsu Software
  Corporation, Norman Walsh, Sun Microsystems, Inc., and the
  Organization for the Advancement of Structured Information
  Standards (OASIS).
  
  Release: $Id: qandaset.rnc 8931 2010-10-20 13:29:20Z nwalsh $
  
  Permission to use, copy, modify and distribute the DocBook schema
  and its accompanying documentation for any purpose and without fee
  is hereby granted in perpetuity, provided that the above copyright
  notice and this paragraph appear in all copies. The copyright
  holders make no representation about the suitability of the schema
  for any purpose. It is provided "as is" without expressed or implied
  warranty.
  
  If you modify the DocBook schema in any way, label your schema as a
  variant of DocBook. See the reference documentation
  (http://docbook.org/tdg5/en/html/ch05.html#s-notdocbook)
  for more information.
  
  Please direct all questions, bug reports, or suggestions for changes
  to the docbook@lists.oasis-open.org mailing list. For more
  information, see http://www.oasis-open.org/docbook/.
  
  ======================================================================
-->
<grammar ns="http://docbook.org/ns/docbook" xmlns:db="http://docbook.org/ns/docbook" xmlns:s="http://purl.oclc.org/dsdl/schematron" xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns:rng="http://relaxng.org/ns/structure/1.0" xmlns:ctrl="http://nwalsh.com/xmlns/schema-control/" xmlns="http://relaxng.org/ns/structure/1.0">
  <start combine="choice">
    <choice>
      <ref name="db.qandadiv"/>
      <ref name="db.qandaentry"/>
      <ref name="db.qandaset"/>
    </choice>
  </start>
  <define name="db.list.blocks" combine="choice">
    <ref name="db.qandaset"/>
  </define>
  <!-- ====================================================================== -->
  <div>
    <db:refname>qandaset</db:refname>
    <db:refpurpose>A question-and-answer set</db:refpurpose>
    <define name="db.qandaset.role.attribute">
      <attribute name="role"/>
    </define>
    <define name="db.qandaset.defaultlabel.enumeration">
      <choice>
        <value>none</value>
        <a:documentation>No labels</a:documentation>
        <value>number</value>
        <a:documentation>Numeric labels</a:documentation>
        <value>qanda</value>
        <a:documentation>"Q:" and "A:" labels</a:documentation>
      </choice>
    </define>
    <define name="db.qandaset.defaultlabel.attribute">
      <attribute name="defaultlabel">
        <db:refpurpose>Specifies the default labelling</db:refpurpose>
        <ref name="db.qandaset.defaultlabel.enumeration"/>
      </attribute>
    </define>
    <define name="db.qandaset.attlist">
      <interleave>
        <optional>
          <ref name="db.qandaset.role.attribute"/>
        </optional>
        <ref name="db.common.attributes"/>
        <ref name="db.common.linking.attributes"/>
        <optional>
          <ref name="db.qandaset.defaultlabel.attribute"/>
        </optional>
      </interleave>
    </define>
    <define name="db.qandaset.info">
      <ref name="db._info.title.only"/>
    </define>
    <define name="db.qandaset">
      <element name="qandaset">
        <ref name="db.qandaset.attlist"/>
        <ref name="db.qandaset.info"/>
        <zeroOrMore>
          <ref name="db.all.blocks"/>
        </zeroOrMore>
        <choice>
          <oneOrMore>
            <ref name="db.qandadiv"/>
          </oneOrMore>
          <oneOrMore>
            <ref name="db.qandaentry"/>
          </oneOrMore>
        </choice>
      </element>
    </define>
  </div>
  <!-- ====================================================================== -->
  <div>
    <db:refname>qandadiv</db:refname>
    <db:refpurpose>A titled division in a qandaset</db:refpurpose>
    <define name="db.qandadiv.role.attribute">
      <attribute name="role"/>
    </define>
    <define name="db.qandadiv.attlist">
      <interleave>
        <optional>
          <ref name="db.qandadiv.role.attribute"/>
        </optional>
        <ref name="db.common.attributes"/>
        <ref name="db.common.linking.attributes"/>
      </interleave>
    </define>
    <define name="db.qandadiv.info">
      <ref name="db._info.title.only"/>
    </define>
    <define name="db.qandadiv">
      <element name="qandadiv">
        <ref name="db.qandadiv.attlist"/>
        <ref name="db.qandadiv.info"/>
        <zeroOrMore>
          <ref name="db.all.blocks"/>
        </zeroOrMore>
        <choice>
          <oneOrMore>
            <ref name="db.qandadiv"/>
          </oneOrMore>
          <oneOrMore>
            <ref name="db.qandaentry"/>
          </oneOrMore>
        </choice>
      </element>
    </define>
  </div>
  <!-- ====================================================================== -->
  <div>
    <db:refname>qandaentry</db:refname>
    <db:refpurpose>A question/answer set within a qandaset</db:refpurpose>
    <define name="db.qandaentry.role.attribute">
      <attribute name="role"/>
    </define>
    <define name="db.qandaentry.attlist">
      <interleave>
        <optional>
          <ref name="db.qandaentry.role.attribute"/>
        </optional>
        <ref name="db.common.attributes"/>
        <ref name="db.common.linking.attributes"/>
      </interleave>
    </define>
    <define name="db.qandaentry.info">
      <ref name="db._info.title.only"/>
    </define>
    <define name="db.qandaentry">
      <element name="qandaentry">
        <ref name="db.qandaentry.attlist"/>
        <ref name="db.qandaentry.info"/>
        <ref name="db.question"/>
        <zeroOrMore>
          <ref name="db.answer"/>
        </zeroOrMore>
      </element>
    </define>
  </div>
  <!-- ====================================================================== -->
  <div>
    <db:refname>question</db:refname>
    <db:refpurpose>A question in a qandaset</db:refpurpose>
    <define name="db.question.role.attribute">
      <attribute name="role"/>
    </define>
    <define name="db.question.attlist">
      <interleave>
        <optional>
          <ref name="db.question.role.attribute"/>
        </optional>
        <ref name="db.common.attributes"/>
        <ref name="db.common.linking.attributes"/>
      </interleave>
    </define>
    <define name="db.question">
      <element name="question">
        <ref name="db.question.attlist"/>
        <optional>
          <ref name="db.label"/>
        </optional>
        <oneOrMore>
          <ref name="db.all.blocks"/>
        </oneOrMore>
      </element>
    </define>
  </div>
  <!-- ====================================================================== -->
  <div>
    <db:refname>answer</db:refname>
    <db:refpurpose>An answer to a question posed in a qandaset</db:refpurpose>
    <define name="db.answer.role.attribute">
      <attribute name="role"/>
    </define>
    <define name="db.answer.attlist">
      <interleave>
        <optional>
          <ref name="db.answer.role.attribute"/>
        </optional>
        <ref name="db.common.attributes"/>
        <ref name="db.common.linking.attributes"/>
      </interleave>
    </define>
    <define name="db.answer">
      <element name="answer">
        <ref name="db.answer.attlist"/>
        <optional>
          <ref name="db.label"/>
        </optional>
        <oneOrMore>
          <ref name="db.all.blocks"/>
        </oneOrMore>
      </element>
    </define>
  </div>
  <!-- ====================================================================== -->
  <div>
    <db:refname>label</db:refname>
    <db:refpurpose>A label on a question or answer</db:refpurpose>
    <define name="db.label.role.attribute">
      <attribute name="role"/>
    </define>
    <define name="db.label.attlist">
      <interleave>
        <optional>
          <ref name="db.label.role.attribute"/>
        </optional>
        <ref name="db.common.attributes"/>
        <ref name="db.common.linking.attributes"/>
      </interleave>
    </define>
    <define name="db.label">
      <element name="label">
        <ref name="db.label.attlist"/>
        <ref name="db._text"/>
      </element>
    </define>
  </div>
</grammar>
