<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
  <!--
    Currently we inherit from a namespaced grammar, isostandard. Until we inherit from isodoc,
    we cannot have a new default namespace: we will end up with a grammar with two different
    namespaces, one for isostandard and one for csand additions. And we do not want that.
  -->
  <include href="isostandard.rng">
    <start>
      <ref name="acme-standard"/>
    </start>
    <define name="figure">
      <element name="figure">
        <attribute name="id">
          <data type="ID"/>
        </attribute>
        <optional>
          <ref name="tname"/>
        </optional>
        <choice>
          <ref name="image"/>
          <ref name="pre"/>
          <oneOrMore>
            <ref name="subfigure"/>
          </oneOrMore>
        </choice>
        <zeroOrMore>
          <ref name="fn"/>
        </zeroOrMore>
        <optional>
          <ref name="dl"/>
        </optional>
        <zeroOrMore>
          <ref name="note"/>
        </zeroOrMore>
      </element>
    </define>
    <define name="subfigure">
      <element name="figure">
        <attribute name="id">
          <data type="ID"/>
        </attribute>
        <optional>
          <ref name="tname"/>
        </optional>
        <choice>
          <ref name="image"/>
          <ref name="pre"/>
        </choice>
      </element>
    </define>
    <define name="DocumentType">
      <choice>
        <value>policy-and-procedures</value>
        <value>best-practices</value>
        <value>supporting-document</value>
        <value>report</value>
        <value>legal</value>
        <value>directives</value>
        <value>proposal</value>
        <value>standard</value>
      </choice>
    </define>
    <define name="editorialgroup">
      <element name="editorialgroup">
        <oneOrMore>
          <ref name="committee"/>
        </oneOrMore>
      </element>
    </define>
    <define name="BibDataExtensionType">
      <optional>
        <ref name="doctype"/>
      </optional>
      <ref name="editorialgroup"/>
      <zeroOrMore>
        <ref name="ics"/>
      </zeroOrMore>
      <optional>
        <ref name="security"/>
      </optional>
    </define>
  </include>
  <define name="committee">
    <element name="committee">
      <attribute name="type">
        <choice>
          <value>technical</value>
          <value>provisional</value>
        </choice>
      </attribute>
      <text/>
    </element>
  </define>
  <define name="security">
    <element name="security">
      <text/>
    </element>
  </define>
  <define name="acme-standard">
    <element name="acme-standard">
      <ref name="bibdata"/>
      <zeroOrMore>
        <ref name="termdocsource"/>
      </zeroOrMore>
      <optional>
        <ref name="boilerplate"/>
      </optional>
      <ref name="preface"/>
      <oneOrMore>
        <ref name="sections"/>
      </oneOrMore>
      <zeroOrMore>
        <ref name="annex"/>
      </zeroOrMore>
      <ref name="bibliography"/>
    </element>
  </define>
</grammar>