<?xml version="1.0" encoding="UTF-8"?>
<grammar
 xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
 xmlns="http://relaxng.org/ns/structure/1.0"
 datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
  <!-- xml2rfc Version 2 grammar -->
  <define name="rfc">
    <element name="rfc">
      <optional>
        <attribute name="number"/>
      </optional>
      <optional>
        <attribute name="obsoletes" a:defaultValue=""/>
      </optional>
      <optional>
        <attribute name="updates" a:defaultValue=""/>
      </optional>
      <optional>
        <attribute name="category">
          <choice>
            <value>std</value>
            <value>bcp</value>
            <value>info</value>
            <value>exp</value>
            <value>historic</value>
          </choice>
        </attribute>
      </optional>
      <optional>
        <attribute name="consensus">
          <choice>
            <value>no</value>
            <value>yes</value>
          </choice>
        </attribute>
      </optional>
      <optional>
        <attribute name="seriesNo"/>
      </optional>
      <optional>
        <attribute name="ipr">
          <choice>
            <value>full2026</value>
            <value>noDerivativeWorks2026</value>
            <value>none</value>
            <value>full3667</value>
            <value>noModification3667</value>
            <value>noDerivatives3667</value>
            <value>full3978</value>
            <value>noModification3978</value>
            <value>noDerivatives3978</value>
            <value>trust200811</value>
            <value>noModificationTrust200811</value>
            <value>noDerivativesTrust200811</value>
            <value>trust200902</value>
            <value>noModificationTrust200902</value>
            <value>noDerivativesTrust200902</value>
            <value>pre5378Trust200902</value>
          </choice>
        </attribute>
      </optional>
      <optional>
        <attribute name="iprExtract">
          <data type="IDREF"/>
        </attribute>
      </optional>
      <optional>
        <attribute name="submissionType" a:defaultValue="IETF">
          <choice>
            <value>IETF</value>
            <value>IAB</value>
            <value>IRTF</value>
            <value>independent</value>
          </choice>
        </attribute>
      </optional>
      <optional>
        <attribute name="docName"/>
      </optional>
      <optional>
        <attribute name="xml:lang" a:defaultValue="en"/>
      </optional>
      <ref name="front"/>
      <ref name="middle"/>
      <optional>
        <ref name="back"/>
      </optional>
    </element>
  </define>
  <define name="front">
    <element name="front">
      <ref name="title"/>
      <oneOrMore>
        <ref name="author"/>
      </oneOrMore>
      <ref name="date"/>
      <zeroOrMore>
        <ref name="area"/>
      </zeroOrMore>
      <zeroOrMore>
        <ref name="workgroup"/>
      </zeroOrMore>
      <zeroOrMore>
        <ref name="keyword"/>
      </zeroOrMore>
      <optional>
        <ref name="abstract"/>
      </optional>
      <zeroOrMore>
        <ref name="note"/>
      </zeroOrMore>
    </element>
  </define>
  <define name="title">
    <element name="title">
      <optional>
        <attribute name="abbrev"/>
      </optional>
      <text/>
    </element>
  </define>
  <define name="author">
    <element name="author">
      <optional>
        <attribute name="initials"/>
      </optional>
      <optional>
        <attribute name="surname"/>
      </optional>
      <optional>
        <attribute name="fullname"/>
      </optional>
      <optional>
        <attribute name="role">
          <value>editor</value>
        </attribute>
      </optional>
      <optional>
        <ref name="organization"/>
      </optional>
      <optional>
        <ref name="address"/>
      </optional>
    </element>
  </define>
  <define name="organization">
    <element name="organization">
      <optional>
        <attribute name="abbrev"/>
      </optional>
      <text/>
    </element>
  </define>
  <define name="address">
    <element name="address">
      <optional>
        <ref name="postal"/>
      </optional>
      <optional>
        <ref name="phone"/>
      </optional>
      <optional>
        <ref name="facsimile"/>
      </optional>
      <optional>
        <ref name="email"/>
      </optional>
      <optional>
        <ref name="uri"/>
      </optional>
    </element>
  </define>
  <define name="postal">
    <element name="postal">
      <oneOrMore>
        <ref name="street"/>
      </oneOrMore>
      <zeroOrMore>
        <choice>
          <ref name="city"/>
          <ref name="region"/>
          <ref name="code"/>
          <ref name="country"/>
        </choice>
      </zeroOrMore>
    </element>
  </define>
  <define name="street">
    <element name="street">
      <text/>
    </element>
  </define>
  <define name="city">
    <element name="city">
      <text/>
    </element>
  </define>
  <define name="region">
    <element name="region">
      <text/>
    </element>
  </define>
  <define name="code">
    <element name="code">
      <text/>
    </element>
  </define>
  <define name="country">
    <element name="country">
      <text/>
    </element>
  </define>
  <define name="phone">
    <element name="phone">
      <text/>
    </element>
  </define>
  <define name="facsimile">
    <element name="facsimile">
      <text/>
    </element>
  </define>
  <define name="email">
    <element name="email">
      <text/>
    </element>
  </define>
  <define name="uri">
    <element name="uri">
      <text/>
    </element>
  </define>
  <define name="date">
    <element name="date">
      <optional>
        <attribute name="day"/>
      </optional>
      <optional>
        <attribute name="month"/>
      </optional>
      <optional>
        <attribute name="year"/>
      </optional>
      <empty/>
    </element>
  </define>
  <define name="area">
    <element name="area">
      <text/>
    </element>
  </define>
  <define name="workgroup">
    <element name="workgroup">
      <text/>
    </element>
  </define>
  <define name="keyword">
    <element name="keyword">
      <text/>
    </element>
  </define>
  <define name="abstract">
    <element name="abstract">
      <oneOrMore>
        <ref name="t"/>
      </oneOrMore>
    </element>
  </define>
  <define name="note">
    <element name="note">
      <attribute name="title"/>
      <oneOrMore>
        <ref name="t"/>
      </oneOrMore>
    </element>
  </define>
  <define name="middle">
    <element name="middle">
      <oneOrMore>
        <ref name="section"/>
      </oneOrMore>
    </element>
  </define>
  <define name="section">
    <element name="section">
      <optional>
        <attribute name="anchor">
          <data type="ID"/>
        </attribute>
      </optional>
      <attribute name="title"/>
      <optional>
        <attribute name="toc" a:defaultValue="default">
          <choice>
            <value>include</value>
            <value>exclude</value>
            <value>default</value>
          </choice>
        </attribute>
      </optional>
      <zeroOrMore>
        <choice>
          <ref name="t"/>
          <ref name="figure"/>
          <ref name="texttable"/>
          <ref name="iref"/>
        </choice>
      </zeroOrMore>
      <zeroOrMore>
        <ref name="section"/>
      </zeroOrMore>
    </element>
  </define>
  <define name="t">
    <element name="t">
      <optional>
        <attribute name="anchor">
          <data type="ID"/>
        </attribute>
      </optional>
      <optional>
        <attribute name="hangText"/>
      </optional>
      <zeroOrMore>
        <choice>
          <text/>
          <ref name="list"/>
          <ref name="figure"/>
          <ref name="xref"/>
          <ref name="eref"/>
          <ref name="iref"/>
          <ref name="cref"/>
          <ref name="spanx"/>
          <ref name="vspace"/>
        </choice>
      </zeroOrMore>
    </element>
  </define>
  <define name="list">
    <element name="list">
      <optional>
        <attribute name="style"/>
      </optional>
      <optional>
        <attribute name="hangIndent"/>
      </optional>
      <optional>
        <attribute name="counter"/>
      </optional>
      <oneOrMore>
        <ref name="t"/>
      </oneOrMore>
    </element>
  </define>
  <define name="xref">
    <element name="xref">
      <attribute name="target">
        <data type="IDREF"/>
      </attribute>
      <optional>
        <attribute name="pageno" a:defaultValue="false">
          <choice>
            <value>true</value>
            <value>false</value>
          </choice>
        </attribute>
      </optional>
      <optional>
        <attribute name="format" a:defaultValue="default">
          <choice>
            <value>counter</value>
            <value>title</value>
            <value>none</value>
            <value>default</value>
          </choice>
        </attribute>
      </optional>
      <text/>
    </element>
  </define>
  <define name="eref">
    <element name="eref">
      <attribute name="target"/>
      <text/>
    </element>
  </define>
  <define name="iref">
    <element name="iref">
      <attribute name="item"/>
      <optional>
        <attribute name="subitem" a:defaultValue=""/>
      </optional>
      <optional>
        <attribute name="primary" a:defaultValue="false">
          <choice>
            <value>true</value>
            <value>false</value>
          </choice>
        </attribute>
      </optional>
      <empty/>
    </element>
  </define>
  <define name="cref">
    <element name="cref">
      <optional>
        <attribute name="anchor">
          <data type="ID"/>
        </attribute>
      </optional>
      <optional>
        <attribute name="source"/>
      </optional>
      <text/>
    </element>
  </define>
  <define name="spanx">
    <element name="spanx">
      <optional>
        <attribute name="xml:space" a:defaultValue="preserve">
          <choice>
            <value>default</value>
            <value>preserve</value>
          </choice>
        </attribute>
      </optional>
      <optional>
        <attribute name="style" a:defaultValue="emph"/>
      </optional>
      <text/>
    </element>
  </define>
  <define name="vspace">
    <element name="vspace">
      <optional>
        <attribute name="blankLines" a:defaultValue="0"/>
      </optional>
      <empty/>
    </element>
  </define>
  <define name="figure">
    <element name="figure">
      <optional>
        <attribute name="anchor">
          <data type="ID"/>
        </attribute>
      </optional>
      <optional>
        <attribute name="title" a:defaultValue=""/>
      </optional>
      <optional>
        <attribute name="suppress-title" a:defaultValue="false">
          <choice>
            <value>true</value>
            <value>false</value>
          </choice>
        </attribute>
      </optional>
      <optional>
        <attribute name="src"/>
      </optional>
      <optional>
        <attribute name="align" a:defaultValue="left">
          <choice>
            <value>left</value>
            <value>center</value>
            <value>right</value>
          </choice>
        </attribute>
      </optional>
      <optional>
        <attribute name="alt" a:defaultValue=""/>
      </optional>
      <optional>
        <attribute name="width" a:defaultValue=""/>
      </optional>
      <optional>
        <attribute name="height" a:defaultValue=""/>
      </optional>
      <zeroOrMore>
        <ref name="iref"/>
      </zeroOrMore>
      <optional>
        <ref name="preamble"/>
      </optional>
      <ref name="artwork"/>
      <optional>
        <ref name="postamble"/>
      </optional>
    </element>
  </define>
  <define name="preamble">
    <element name="preamble">
      <zeroOrMore>
        <choice>
          <text/>
          <ref name="xref"/>
          <ref name="eref"/>
          <ref name="iref"/>
          <ref name="cref"/>
          <ref name="spanx"/>
        </choice>
      </zeroOrMore>
    </element>
  </define>
  <define name="artwork">
    <element name="artwork">
      <optional>
        <attribute name="xml:space" a:defaultValue="preserve">
          <choice>
            <value>default</value>
            <value>preserve</value>
          </choice>
        </attribute>
      </optional>
      <optional>
        <attribute name="name" a:defaultValue=""/>
      </optional>
      <optional>
        <attribute name="type" a:defaultValue=""/>
      </optional>
      <optional>
        <attribute name="src"/>
      </optional>
      <optional>
        <attribute name="align" a:defaultValue="left">
          <choice>
            <value>left</value>
            <value>center</value>
            <value>right</value>
          </choice>
        </attribute>
      </optional>
      <optional>
        <attribute name="alt" a:defaultValue=""/>
      </optional>
      <optional>
        <attribute name="width" a:defaultValue=""/>
      </optional>
      <optional>
        <attribute name="height" a:defaultValue=""/>
      </optional>
      <zeroOrMore>
        <text/>
      </zeroOrMore>
    </element>
  </define>
  <define name="postamble">
    <element name="postamble">
      <zeroOrMore>
        <choice>
          <text/>
          <ref name="xref"/>
          <ref name="eref"/>
          <ref name="iref"/>
          <ref name="cref"/>
          <ref name="spanx"/>
        </choice>
      </zeroOrMore>
    </element>
  </define>
  <define name="texttable">
    <element name="texttable">
      <optional>
        <attribute name="anchor">
          <data type="ID"/>
        </attribute>
      </optional>
      <optional>
        <attribute name="title" a:defaultValue=""/>
      </optional>
      <optional>
        <attribute name="suppress-title" a:defaultValue="false">
          <choice>
            <value>true</value>
            <value>false</value>
          </choice>
        </attribute>
      </optional>
      <optional>
        <attribute name="align" a:defaultValue="center">
          <choice>
            <value>left</value>
            <value>center</value>
            <value>right</value>
          </choice>
        </attribute>
      </optional>
      <optional>
        <attribute name="style" a:defaultValue="full">
          <choice>
            <value>all</value>
            <value>none</value>
            <value>headers</value>
            <value>full</value>
          </choice>
        </attribute>
      </optional>
      <optional>
        <ref name="preamble"/>
      </optional>
      <oneOrMore>
        <ref name="ttcol"/>
      </oneOrMore>
      <zeroOrMore>
        <ref name="c"/>
      </zeroOrMore>
      <optional>
        <ref name="postamble"/>
      </optional>
    </element>
  </define>
  <define name="ttcol">
    <element name="ttcol">
      <optional>
        <attribute name="width"/>
      </optional>
      <optional>
        <attribute name="align" a:defaultValue="left">
          <choice>
            <value>left</value>
            <value>center</value>
            <value>right</value>
          </choice>
        </attribute>
      </optional>
      <text/>
    </element>
  </define>
  <define name="c">
    <element name="c">
      <zeroOrMore>
        <choice>
          <text/>
          <ref name="xref"/>
          <ref name="eref"/>
          <ref name="iref"/>
          <ref name="cref"/>
          <ref name="spanx"/>
        </choice>
      </zeroOrMore>
    </element>
  </define>
  <define name="back">
    <element name="back">
      <zeroOrMore>
        <ref name="references"/>
      </zeroOrMore>
      <zeroOrMore>
        <ref name="section"/>
      </zeroOrMore>
    </element>
  </define>
  <define name="references">
    <element name="references">
      <optional>
        <attribute name="title" a:defaultValue="References"/>
      </optional>
      <oneOrMore>
        <ref name="reference"/>
      </oneOrMore>
    </element>
  </define>
  <define name="reference">
    <element name="reference">
      <attribute name="anchor">
        <data type="ID"/>
      </attribute>
      <optional>
        <attribute name="target"/>
      </optional>
      <ref name="front"/>
      <zeroOrMore>
        <ref name="seriesInfo"/>
      </zeroOrMore>
      <zeroOrMore>
        <ref name="format"/>
      </zeroOrMore>
      <zeroOrMore>
        <ref name="annotation"/>
      </zeroOrMore>
    </element>
  </define>
  <define name="seriesInfo">
    <element name="seriesInfo">
      <attribute name="name"/>
      <attribute name="value"/>
      <empty/>
    </element>
  </define>
  <define name="format">
    <element name="format">
      <optional>
        <attribute name="target"/>
      </optional>
      <attribute name="type"/>
      <optional>
        <attribute name="octets"/>
      </optional>
      <empty/>
    </element>
  </define>
  <define name="annotation">
    <element name="annotation">
      <zeroOrMore>
        <choice>
          <text/>
          <ref name="xref"/>
          <ref name="eref"/>
          <ref name="iref"/>
          <ref name="cref"/>
          <ref name="spanx"/>
        </choice>
      </zeroOrMore>
    </element>
  </define>
  <start>
    <ref name="rfc"/>
  </start>
</grammar>
