<?xml version="1.0" encoding="UTF-8"?>
<!--
  	ibtwsh.dtd
  	This is the Itsy Bitsy Teeny Weeny Simple Hypertext DTD.
  	Its public identifier is -//XML-DEV List//DTD IBTWSH 6.0//EN
  	The contents are dedicated to the public domain by
  		the author, John Cowan <cowan@ccil.org>, except that
  		John Cowan retains the moral right to be known as the author.
  	This is draft 6.2
  	Diff from 6.1: rel|rel now rel|rev, th|td@headers now IDREFS,
  		table width no longer an integer, non-basic table attrs gone,
  		rowspan and colspan must be non-negative
  	Diff from 6.0: added attributes to ul, comment about img, new meta
-->
<!--
  This is a RELAX NG schema which describes a subset of XHTML Basic for
  use within other schemas.  It is by intention equivalent
  (within its scope) to -//W3C//DTD XHTML 1.1//EN, but is
  not a derived work in the copyright sense.
-->
<!--
  It is often convenient for XML documents to have a bit of
  documentation somewhere in them.  In the absence of a schema like
  this one, that documentation winds up being <text/> only, which is
  a pity, because rich text adds measurably to the readability of
  documents.  By incorporating this schema by reference (as an
  external parameter entity) into another schema, that schema inherits
  the capabilities of this one.  Using HTML-compatible elements
  and attributes allows the documentation to be passed straight
  through to HTML renderers.
-->
<!--
  Current HTML renderers can cope with most XML tags, but empty
  tags require special treatment.  Inserting a space before the
  terminating "/>" usually makes the "/" (which is not HTML)
  invisible.  Using "<tag></tag>" is not as effective, as the
  latter is often misinterpreted as a second "<tag>".
-->
<!--
  Note that since the elements of this schema are intended to be
  used within domain-specific elements of the surrounding DTD,
  it is not necessary that every fragment begin with an "html"
  element, as in HTML.  Recommended <define>s for elements
  containing documentation are "horiz.model" for simple
  text fragments and "struct.model" for documents in extenso.
-->
<!-- Declarations -->
<grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
  <!-- Common attributes -->
  <!-- All elements (except full-document elements) can have these attributes -->
  <define name="all">
    <optional>
      <attribute name="id">
        <data type="ID"/>
      </attribute>
    </optional>
    <optional>
      <attribute name="class">
        <data type="token" datatypeLibrary=""/>
      </attribute>
    </optional>
    <optional>
      <attribute name="title"/>
    </optional>
  </define>
  <!-- All non-empty elements can have these attributes -->
  <define name="i18n">
    <optional>
      <attribute name="xml:lang"/>
    </optional>
    <optional>
      <attribute name="dir">
        <choice>
          <value>ltr</value>
          <value>rtl</value>
        </choice>
      </attribute>
    </optional>
  </define>
  <define name="basic">
    <ref name="all"/>
    <ref name="i18n"/>
  </define>
  <!-- Models -->
  <define name="horiz.model">
    <interleave>
      <ref name="basic"/>
      <text/>
      <zeroOrMore>
        <ref name="horiz"/>
      </zeroOrMore>
    </interleave>
  </define>
  <define name="vert.model">
    <interleave>
      <ref name="horiz.model"/>
      <zeroOrMore>
        <ref name="vert"/>
      </zeroOrMore>
    </interleave>
  </define>
  <define name="struct.model">
    <interleave>
      <ref name="basic"/>
      <zeroOrMore>
        <ref name="vert"/>
      </zeroOrMore>
    </interleave>
  </define>
  <!-- Horizontal formatting elements -->
  <define name="horiz">
    <choice>
      <ref name="a"/>
      <ref name="br"/>
      <ref name="horiz.other"/>
    </choice>
  </define>
  <define name="a">
    <element name="a">
      <optional>
        <attribute name="href">
          <data type="anyURI"/>
        </attribute>
      </optional>
      <optional>
        <attribute name="name"/>
      </optional>
      <optional>
        <attribute>
          <choice>
            <name ns="">rel</name>
            <name ns="">rev</name>
          </choice>
          <data type="anyURI"/>
        </attribute>
      </optional>
      <ref name="horiz.model"/>
    </element>
  </define>
  <define name="br">
    <element name="br">
      <ref name="all"/>
      <empty/>
    </element>
  </define>
  <define name="horiz.other">
    <element>
      <choice>
        <name>abbr</name>
        <name>acronym</name>
        <name>cite</name>
        <name>code</name>
        <name>dfn</name>
        <name>em</name>
        <name>img</name>
        <name>kbd</name>
        <name>q</name>
        <name>samp</name>
        <name>span</name>
        <name>strong</name>
        <name>var</name>
      </choice>
      <ref name="horiz.model"/>
    </element>
  </define>
  <!-- Vertical formatting elements -->
  <define name="vert">
    <choice>
      <ref name="header"/>
      <ref name="List"/>
      <ref name="table"/>
      <ref name="vert.other"/>
    </choice>
  </define>
  <define name="header">
    <element>
      <choice>
        <name>h1</name>
        <name>h2</name>
        <name>h3</name>
      </choice>
      <ref name="horiz.model"/>
    </element>
  </define>
  <define name="List">
    <choice>
      <element name="dl">
        <ref name="basic"/>
        <oneOrMore>
          <element>
            <choice>
              <name>dt</name>
              <name>dd</name>
            </choice>
            <ref name="horiz.model"/>
          </element>
        </oneOrMore>
      </element>
      <element>
        <choice>
          <name>ol</name>
          <name>ul</name>
        </choice>
        <ref name="basic"/>
        <oneOrMore>
          <element name="li">
            <ref name="horiz.model"/>
          </element>
        </oneOrMore>
      </element>
    </choice>
  </define>
  <define name="aligns">
    <optional>
      <attribute name="align">
        <choice>
          <value>left</value>
          <value>center</value>
          <value>right</value>
          <value>justified</value>
        </choice>
      </attribute>
    </optional>
    <optional>
      <attribute name="valign">
        <choice>
          <value>top</value>
          <value>middle</value>
          <value>bottom</value>
          <value>baseline</value>
        </choice>
      </attribute>
    </optional>
  </define>
  <define name="table">
    <element name="table">
      <ref name="basic"/>
      <optional>
        <attribute name="summary"/>
      </optional>
      <optional>
        <element name="caption">
          <ref name="horiz.model"/>
        </element>
      </optional>
      <oneOrMore>
        <element name="tr">
          <ref name="basic"/>
          <ref name="aligns"/>
          <oneOrMore>
            <ref name="tabledata"/>
          </oneOrMore>
        </element>
      </oneOrMore>
    </element>
  </define>
  <define name="tabledata">
    <element>
      <choice>
        <name>th</name>
        <name>td</name>
      </choice>
      <ref name="aligns"/>
      <optional>
        <attribute name="abbr"/>
      </optional>
      <optional>
        <attribute name="axis"/>
      </optional>
      <optional>
        <attribute name="colspan">
          <data type="nonNegativeInteger"/>
        </attribute>
      </optional>
      <optional>
        <attribute name="headers">
          <data type="IDREFS"/>
        </attribute>
      </optional>
      <optional>
        <attribute name="rowspan">
          <data type="nonNegativeInteger"/>
        </attribute>
      </optional>
      <optional>
        <attribute name="scope">
          <choice>
            <value>row</value>
            <value>col</value>
            <value>rowgroup</value>
            <value>colgroup</value>
          </choice>
        </attribute>
      </optional>
      <ref name="vert.model"/>
    </element>
  </define>
  <define name="vert.other">
    <choice>
      <element name="address">
        <ref name="horiz.model"/>
      </element>
      <element name="blockquote">
        <optional>
          <attribute name="cite">
            <data type="anyURI"/>
          </attribute>
        </optional>
        <ref name="struct.model"/>
      </element>
      <element name="div">
        <ref name="struct.model"/>
      </element>
      <element name="p">
        <ref name="horiz.model"/>
      </element>
      <element name="pre">
        <ref name="horiz.model"/>
      </element>
    </choice>
  </define>
  <!-- Support for complete HTML documents -->
  <start>
    <element name="html">
      <ref name="i18n"/>
      <optional>
        <attribute name="xml:base">
          <data type="anyURI"/>
        </attribute>
      </optional>
      <optional>
        <attribute name="xml:space">
          <choice>
            <value>preserve</value>
            <value>default</value>
          </choice>
        </attribute>
      </optional>
      <ref name="head"/>
      <element name="body">
        <ref name="basic"/>
        <zeroOrMore>
          <ref name="vert"/>
        </zeroOrMore>
      </element>
    </element>
  </start>
  <define name="head">
    <element name="head">
      <ref name="i18n"/>
      <element name="title">
        <ref name="i18n"/>
        <text/>
      </element>
      <zeroOrMore>
        <element name="meta">
          <optional>
            <attribute>
              <choice>
                <name ns="">name</name>
                <name ns="">http-equiv</name>
              </choice>
              <data type="token" datatypeLibrary=""/>
            </attribute>
          </optional>
          <attribute name="content"/>
          <empty/>
        </element>
      </zeroOrMore>
    </element>
  </define>
</grammar>
<!-- END OF ibtwsh.rnx -->
