metanorma/metanorma-iec

View on GitHub
lib/metanorma/iec/isostandard.rng

Summary

Maintainability
Test Coverage
<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
  <!--
    VERSION v1.2.1
    default namespace isostandard = "https://www.metanorma.com/ns/iso"
  -->
  <include href="isodoc.rng">
    <start>
      <ref name="iso-standard"/>
    </start>
    <define name="sections">
      <element name="sections">
        <zeroOrMore>
          <choice>
            <ref name="note"/>
            <ref name="admonition"/>
          </choice>
        </zeroOrMore>
        <ref name="clause"/>
        <optional>
          <choice>
            <ref name="term-clause"/>
            <ref name="terms"/>
          </choice>
        </optional>
        <optional>
          <ref name="definitions"/>
        </optional>
        <oneOrMore>
          <choice>
            <ref name="clause"/>
            <ref name="term-clause"/>
            <ref name="terms"/>
          </choice>
        </oneOrMore>
      </element>
    </define>
    <define name="Clause-Section">
      <optional>
        <attribute name="id">
          <data type="ID"/>
        </attribute>
      </optional>
      <optional>
        <attribute name="language"/>
      </optional>
      <optional>
        <attribute name="script"/>
      </optional>
      <optional>
        <attribute name="inline-header">
          <data type="boolean"/>
        </attribute>
      </optional>
      <optional>
        <attribute name="obligation">
          <choice>
            <value>normative</value>
            <value>informative</value>
          </choice>
        </attribute>
      </optional>
      <optional>
        <attribute name="type"/>
      </optional>
      <optional>
        <ref name="section-title"/>
      </optional>
      <choice>
        <choice>
          <oneOrMore>
            <ref name="BasicBlock"/>
          </oneOrMore>
          <ref name="amend"/>
        </choice>
        <oneOrMore>
          <ref name="clause-subsection"/>
        </oneOrMore>
      </choice>
    </define>
    <define name="term">
      <element name="term">
        <optional>
          <attribute name="id">
            <data type="ID"/>
          </attribute>
        </optional>
        <optional>
          <attribute name="language"/>
        </optional>
        <optional>
          <attribute name="script"/>
        </optional>
        <ref name="BlockAttributes"/>
        <ref name="preferred"/>
        <zeroOrMore>
          <ref name="admitted"/>
        </zeroOrMore>
        <zeroOrMore>
          <ref name="deprecates"/>
        </zeroOrMore>
        <optional>
          <ref name="termdomain"/>
        </optional>
        <ref name="termdefinition"/>
        <zeroOrMore>
          <ref name="termnote"/>
        </zeroOrMore>
        <zeroOrMore>
          <ref name="termexample"/>
        </zeroOrMore>
        <zeroOrMore>
          <ref name="termsource"/>
        </zeroOrMore>
        <zeroOrMore>
          <ref name="term"/>
        </zeroOrMore>
      </element>
    </define>
    <define name="annex">
      <element name="annex">
        <optional>
          <attribute name="id">
            <data type="ID"/>
          </attribute>
        </optional>
        <optional>
          <attribute name="language"/>
        </optional>
        <optional>
          <attribute name="script"/>
        </optional>
        <optional>
          <attribute name="inline-header">
            <data type="boolean"/>
          </attribute>
        </optional>
        <optional>
          <attribute name="obligation">
            <choice>
              <value>normative</value>
              <value>informative</value>
            </choice>
          </attribute>
        </optional>
        <optional>
          <ref name="section-title"/>
        </optional>
        <zeroOrMore>
          <!--
            allow hanging paragraps in annexes: they introduce lists
            ( paragraph-with-footnote | table | note | formula | admonition | ol | ul | dl | figure | quote | sourcecode | review | example )*,
          -->
          <ref name="BasicBlock"/>
        </zeroOrMore>
        <zeroOrMore>
          <ref name="clause-hanging-paragraph-with-footnote"/>
        </zeroOrMore>
        <zeroOrMore>
          <ref name="annex-appendix"/>
        </zeroOrMore>
      </element>
    </define>
    <define name="AdmonitionType">
      <choice>
        <value>danger</value>
        <value>caution</value>
        <value>warning</value>
        <value>important</value>
        <value>safety precautions</value>
        <value>editorial</value>
      </choice>
    </define>
    <define name="preface">
      <element name="preface">
        <optional>
          <ref name="abstract"/>
        </optional>
        <ref name="foreword"/>
        <optional>
          <ref name="introduction"/>
        </optional>
      </element>
    </define>
    <define name="foreword">
      <element name="foreword">
        <ref name="Basic-Section"/>
      </element>
    </define>
    <define name="introduction">
      <element name="introduction">
        <ref name="Content-Section"/>
      </element>
    </define>
    <define name="Content-Section">
      <optional>
        <attribute name="id">
          <data type="ID"/>
        </attribute>
      </optional>
      <optional>
        <attribute name="language"/>
      </optional>
      <optional>
        <attribute name="script"/>
      </optional>
      <optional>
        <attribute name="inline-header">
          <data type="boolean"/>
        </attribute>
      </optional>
      <optional>
        <attribute name="obligation">
          <choice>
            <value>normative</value>
            <value>informative</value>
          </choice>
        </attribute>
      </optional>
      <optional>
        <attribute name="number"/>
      </optional>
      <optional>
        <attribute name="branch-number"/>
      </optional>
      <optional>
        <attribute name="type"/>
      </optional>
      <optional>
        <ref name="section-title"/>
      </optional>
      <choice>
        <zeroOrMore>
          <ref name="BasicBlock"/>
        </zeroOrMore>
        <oneOrMore>
          <ref name="content-subsection"/>
        </oneOrMore>
      </choice>
    </define>
  </include>
  <!-- end overrides -->
  <!--
    We display the Normative References between scope and terms; but to keep the
    grammar simple, we keep the references together
  -->
  <define name="iso-standard">
    <element name="iso-standard">
      <ref name="Root-Attributes"/>
      <ref name="bibdata"/>
      <zeroOrMore>
        <ref name="termdocsource"/>
      </zeroOrMore>
      <optional>
        <ref name="misccontainer"/>
      </optional>
      <optional>
        <ref name="boilerplate"/>
      </optional>
      <ref name="preface"/>
      <oneOrMore>
        <ref name="sections"/>
      </oneOrMore>
      <zeroOrMore>
        <ref name="annex"/>
      </zeroOrMore>
      <ref name="bibliography"/>
      <zeroOrMore>
        <ref name="indexsect"/>
      </zeroOrMore>
    </element>
  </define>
  <define name="clause-hanging-paragraph-with-footnote">
    <element name="clause">
      <optional>
        <attribute name="id">
          <data type="ID"/>
        </attribute>
      </optional>
      <optional>
        <attribute name="language"/>
      </optional>
      <optional>
        <attribute name="script"/>
      </optional>
      <optional>
        <attribute name="inline-header">
          <data type="boolean"/>
        </attribute>
      </optional>
      <optional>
        <attribute name="obligation">
          <choice>
            <value>normative</value>
            <value>informative</value>
          </choice>
        </attribute>
      </optional>
      <optional>
        <ref name="section-title"/>
      </optional>
      <zeroOrMore>
        <!-- allow hanging paragraphs in annexes: they introduce lists -->
        <ref name="BasicBlock"/>
      </zeroOrMore>
      <zeroOrMore>
        <ref name="clause-hanging-paragraph-with-footnote"/>
      </zeroOrMore>
    </element>
  </define>
  <define name="annex-appendix">
    <element name="appendix">
      <ref name="Clause-Section"/>
    </element>
  </define>
</grammar>