RelaxNG/publidoc.rng
author Yvon BOURBOTTE <yvon.bourbotte@prismallia.fr>
ven., 28 oct. 2011 10:41:08 +0200
changeset 52 cb9addc3d98a
parent 50 5181169ff02d
child 53 37e9f6428d02
permissions -rw-r--r--
Résumé (<abstract>) dans les publisets
<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
  <!-- $Id$ -->
  <start>
    <ref name="publidoc"/>
  </start>
  <define name="publidoc">
    <element name="publidoc">
      <ref name="publidoc.attributes"/>
      <ref name="publidoc.content"/>
    </element>
  </define>
  <define name="publidoc.attributes">
    <ref name="version.attribute"/>
  </define>
  <define name="version.attribute">
    <attribute name="version">
      <value>1.0</value>
    </attribute>
  </define>
  <define name="publidoc.content">
    <choice>
      <ref name="document"/>
      <ref name="top.topic"/>
    </choice>
  </define>
  <!--
    =============================================================================
                                     TOP LEVEL
    =============================================================================
  -->
  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ document ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
  <define name="document">
    <element name="document">
      <ref name="document.attributes"/>
      <ref name="document.content"/>
    </element>
  </define>
  <define name="document.attributes">
    <ref name="document.id.attribute"/>
  </define>
  <define name="document.id.attribute">
    <attribute name="xml:id">
      <data type="ID"/>
    </attribute>
  </define>
  <define name="document.content">
    <optional>
      <ref name="top.head"/>
    </optional>
    <choice>
      <oneOrMore>
        <ref name="division"/>
      </oneOrMore>
      <oneOrMore>
        <ref name="topic"/>
      </oneOrMore>
    </choice>
  </define>
  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ topic ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
  <define name="top.topic">
    <element name="topic">
      <ref name="top.topic.attributes"/>
      <ref name="top.topic.content"/>
    </element>
  </define>
  <define name="top.topic.attributes">
    <interleave>
      <ref name="topic.id.attribute"/>
      <optional>
        <ref name="topic.type.attribute"/>
      </optional>
    </interleave>
  </define>
  <define name="topic.id.attribute">
    <attribute name="xml:id">
      <data type="ID"/>
    </attribute>
  </define>
  <define name="topic.type.attribute">
    <attribute name="type">
      <data type="NCName"/>
    </attribute>
  </define>
  <define name="top.topic.content">
    <optional>
      <ref name="top.head"/>
    </optional>
    <oneOrMore>
      <ref name="section"/>
    </oneOrMore>
  </define>
  <!--
    =============================================================================
                                    HEAD LEVEL
    =============================================================================
  -->
  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ head ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
  <define name="top.head">
    <element name="head">
      <ref name="top.head.content"/>
    </element>
  </define>
  <define name="division.head">
    <element name="head">
      <ref name="division.head.content"/>
    </element>
  </define>
  <define name="component.head">
    <element name="head">
      <ref name="component.head.content"/>
    </element>
  </define>
  <define name="section.head">
    <element name="head">
      <ref name="section.head.content"/>
    </element>
  </define>
  <define name="block.head">
    <element name="head">
      <ref name="block.head.content"/>
    </element>
  </define>
  <define name="top.head.content">
    <interleave>
      <optional>
        <ref name="title"/>
        <optional>
          <ref name="subtitle"/>
        </optional>
      </optional>
      <zeroOrMore>
        <ref name="identifier"/>
      </zeroOrMore>
      <optional>
        <ref name="language"/>
      </optional>
      <optional>
        <ref name="copyright"/>
      </optional>
      <zeroOrMore>
        <ref name="author"/>
      </zeroOrMore>
      <optional>
        <ref name="publisher"/>
      </optional>
      <optional>
        <ref name="date"/>
      </optional>
      <optional>
        <ref name="place"/>
      </optional>
      <zeroOrMore>
        <ref name="source"/>
      </zeroOrMore>
      <optional>
        <ref name="keywordset"/>
      </optional>
      <optional>
        <ref name="subjectset"/>
      </optional>
      <optional>
        <ref name="abstract"/>
      </optional>
      <optional>
        <ref name="cover"/>
      </optional>
      <zeroOrMore>
        <ref name="annotation"/>
      </zeroOrMore>
    </interleave>
  </define>
  <define name="division.head.content">
    <interleave>
      <optional>
        <ref name="title"/>
        <optional>
          <ref name="subtitle"/>
        </optional>
      </optional>
      <optional>
        <ref name="language"/>
      </optional>
      <zeroOrMore>
        <ref name="annotation"/>
      </zeroOrMore>
    </interleave>
  </define>
  <define name="component.head.content">
    <interleave>
      <optional>
        <ref name="title"/>
        <optional>
          <ref name="subtitle"/>
        </optional>
      </optional>
      <optional>
        <ref name="language"/>
      </optional>
      <zeroOrMore>
        <ref name="author"/>
      </zeroOrMore>
      <optional>
        <ref name="abstract"/>
      </optional>
      <zeroOrMore>
        <ref name="annotation"/>
      </zeroOrMore>
    </interleave>
  </define>
  <define name="section.head.content">
    <interleave>
      <optional>
        <ref name="title"/>
        <optional>
          <ref name="subtitle"/>
        </optional>
      </optional>
      <optional>
        <ref name="language"/>
      </optional>
      <optional>
        <ref name="abstract"/>
      </optional>
      <zeroOrMore>
        <ref name="annotation"/>
      </zeroOrMore>
    </interleave>
  </define>
  <define name="block.head.content">
    <optional>
      <ref name="title"/>
      <optional>
        <ref name="subtitle"/>
      </optional>
    </optional>
  </define>
  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ title, subtitle ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
  <define name="title">
    <element name="title">
      <ref name="title.content"/>
    </element>
  </define>
  <define name="subtitle">
    <element name="subtitle">
      <ref name="title.content"/>
    </element>
  </define>
  <define name="title.content">
    <ref name="inlines"/>
  </define>
  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ identifier ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
  <define name="identifier.uri">
    <element name="identifier">
      <attribute name="type">
        <value>uri</value>
      </attribute>
      <data type="anyURI"/>
    </element>
  </define>
  <define name="identifier.ean">
    <element name="identifier">
      <attribute name="type">
        <value>ean</value>
      </attribute>
      <data type="token">
        <param name="pattern">\d{13}</param>
      </data>
    </element>
  </define>
  <define name="identifier">
    <choice>
      <ref name="identifier.uri"/>
      <ref name="identifier.ean"/>
    </choice>
  </define>
  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ language ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
  <define name="language">
    <element name="language">
      <ref name="language.attributes"/>
    </element>
  </define>
  <define name="language.attributes">
    <ref name="lang.attribute"/>
  </define>
  <define name="lang.attribute">
    <attribute name="xml:lang">
      <data type="language"/>
    </attribute>
  </define>
  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ copyright ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
  <define name="copyright">
    <element name="copyright">
      <ref name="copyright.content"/>
    </element>
  </define>
  <define name="copyright.content">
    <ref name="inlines"/>
  </define>
  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ author, publisher ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
  <!-- ~~~~~~ author -->
  <define name="author">
    <element name="author">
      <ref name="author.content"/>
    </element>
  </define>
  <define name="author.content">
    <optional>
      <ref name="firstname"/>
    </optional>
    <ref name="lastname"/>
    <zeroOrMore>
      <ref name="role"/>
    </zeroOrMore>
  </define>
  <!-- ~~~~~~ publisher -->
  <define name="publisher">
    <element name="publisher">
      <ref name="publisher.content"/>
    </element>
  </define>
  <define name="publisher.content">
    <ref name="label"/>
    <optional>
      <ref name="link"/>
    </optional>
  </define>
  <!-- ~~~~~~ firstname -->
  <define name="firstname">
    <element name="firstname">
      <ref name="firstname.content"/>
    </element>
  </define>
  <define name="firstname.content">
    <ref name="inlines"/>
  </define>
  <!-- ~~~~~~ lastname -->
  <define name="lastname">
    <element name="lastname">
      <ref name="lastname.content"/>
    </element>
  </define>
  <define name="lastname.content">
    <ref name="inlines"/>
  </define>
  <!-- ~~~~~~ role -->
  <define name="role">
    <element name="role">
      <ref name="role.attributes"/>
    </element>
  </define>
  <define name="role.attributes">
    <ref name="role.of.attribute"/>
  </define>
  <define name="role.of.attribute">
    <attribute name="of">
      <choice>
        <value>author</value>
        <value>illustrator</value>
      </choice>
    </attribute>
  </define>
  <!-- ~~~~~~ label -->
  <define name="label">
    <element name="label">
      <ref name="label.content"/>
    </element>
  </define>
  <define name="label.content">
    <ref name="inlines"/>
  </define>
  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ place ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
  <define name="place">
    <element name="place">
      <ref name="place.content"/>
    </element>
  </define>
  <define name="place.content">
    <ref name="inlines"/>
  </define>
  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ source ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
  <!-- ~~~~~~ source -->
  <define name="source">
    <element name="source">
      <choice>
        <group>
          <attribute name="type">
            <value>book</value>
          </attribute>
          <ref name="source.content.book"/>
        </group>
        <group>
          <attribute name="type">
            <value>file</value>
          </attribute>
          <ref name="source.content.file"/>
        </group>
      </choice>
      <ref name="source.content"/>
    </element>
  </define>
  <define name="source.content.book">
    <ref name="identifier.ean"/>
    <optional>
      <ref name="title"/>
    </optional>
    <zeroOrMore>
      <ref name="pagenumber"/>
    </zeroOrMore>
  </define>
  <define name="source.content.file">
    <ref name="identifier.uri"/>
  </define>
  <define name="source.content">
    <zeroOrMore>
      <ref name="annotation"/>
    </zeroOrMore>
  </define>
  <!-- ~~~~~~ pagenumber -->
  <define name="pagenumber">
    <element name="pagenumber">
      <ref name="pagenumber.attributes"/>
    </element>
  </define>
  <define name="pagenumber.attributes">
    <ref name="pagenumber.value.attribute"/>
  </define>
  <define name="pagenumber.value.attribute">
    <attribute name="value">
      <data type="positiveInteger"/>
    </attribute>
  </define>
  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ keyword & subject ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
  <!-- ~~~~~~ keywordset -->
  <define name="keywordset">
    <element name="keywordset">
      <ref name="keywordset.content"/>
    </element>
  </define>
  <define name="keywordset.content">
    <oneOrMore>
      <ref name="keyword"/>
    </oneOrMore>
  </define>
  <!-- ~~~~~~ keyword -->
  <define name="keyword">
    <element name="keyword">
      <ref name="keyword.content"/>
    </element>
  </define>
  <define name="keyword.content">
    <text/>
  </define>
  <!-- ~~~~~~ subjectset -->
  <define name="subjectset">
    <element name="subjectset">
      <ref name="subjectset.content"/>
    </element>
  </define>
  <define name="subjectset.content">
    <oneOrMore>
      <ref name="subject"/>
    </oneOrMore>
  </define>
  <!-- ~~~~~~ subject -->
  <define name="subject">
    <element name="subject">
      <ref name="subject.attributes"/>
    </element>
  </define>
  <define name="subject.attributes">
    <ref name="subject.id.attribute"/>
  </define>
  <define name="subject.id.attribute">
    <attribute name="id">
      <data type="NMTOKEN"/>
    </attribute>
  </define>
  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ abstract ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
  <define name="abstract">
    <element name="abstract">
      <ref name="abstract.content"/>
    </element>
  </define>
  <define name="abstract.content">
    <oneOrMore>
      <ref name="p"/>
    </oneOrMore>
  </define>
  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cover ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
  <define name="cover">
    <element name="cover">
      <ref name="cover.content"/>
    </element>
  </define>
  <define name="cover.content">
    <ref name="cover.image"/>
  </define>
  <define name="cover.image">
    <element name="image">
      <ref name="cover.image.attributes"/>
    </element>
  </define>
  <define name="cover.image.attributes">
    <ref name="cover.image.id.attribute"/>
  </define>
  <define name="cover.image.id.attribute">
    <attribute name="id">
      <data type="NMTOKEN"/>
    </attribute>
  </define>
  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ annotation ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
  <define name="annotation">
    <element name="annotation">
      <ref name="annotation.content"/>
    </element>
  </define>
  <define name="annotation.content">
    <ref name="inlines"/>
  </define>
  <!--
    =============================================================================
                                    DIVISION LEVEL
    =============================================================================
  -->
  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ division ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
  <define name="division">
    <element name="division">
      <ref name="division.content"/>
    </element>
  </define>
  <define name="division.content">
    <optional>
      <ref name="division.head"/>
    </optional>
    <choice>
      <oneOrMore>
        <ref name="division"/>
      </oneOrMore>
      <oneOrMore>
        <ref name="topic"/>
      </oneOrMore>
    </choice>
  </define>
  <!--
    =============================================================================
                                  COMPONENT LEVEL
    =============================================================================
  -->
  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ topic ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
  <define name="topic">
    <element name="topic">
      <ref name="topic.attributes"/>
      <ref name="topic.content"/>
    </element>
  </define>
  <define name="topic.attributes">
    <interleave>
      <optional>
        <ref name="topic.id.attribute"/>
      </optional>
      <optional>
        <ref name="topic.type.attribute"/>
      </optional>
    </interleave>
  </define>
  <define name="topic.content">
    <optional>
      <ref name="component.head"/>
    </optional>
    <oneOrMore>
      <ref name="section"/>
    </oneOrMore>
  </define>
  <!--
    =============================================================================
                                    SECTION LEVEL
    =============================================================================
  -->
  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ section ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
  <define name="section">
    <element name="section">
      <ref name="section.content"/>
      <ref name="section.attributes"/>
    </element>
  </define>
  <define name="section.content">
    <optional>
      <ref name="section.head"/>
    </optional>
    <choice>
      <oneOrMore>
        <ref name="section"/>
      </oneOrMore>
      <oneOrMore>
        <ref name="block"/>
      </oneOrMore>
    </choice>
  </define>
  <define name="section.attributes">
    <optional>
      <ref name="section.type.attribute"/>
    </optional>
  </define>
  <define name="section.type.attribute">
    <attribute name="type">
      <data type="NCName"/>
    </attribute>
  </define>
  <!--
    =============================================================================
                                    BLOCK LEVEL
    =============================================================================
  -->
  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ block ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
  <define name="block">
    <choice>
      <ref name="p"/>
      <ref name="speech"/>
      <ref name="list"/>
      <ref name="blockquote"/>
      <ref name="table"/>
      <ref name="media"/>
    </choice>
  </define>
  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ p ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
  <define name="p">
    <element name="p">
      <ref name="p.content"/>
    </element>
  </define>
  <define name="p.content">
    <ref name="inlines"/>
  </define>
  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ speech ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
  <!-- ~~~~~~ speech -->
  <define name="speech">
    <element name="speech">
      <ref name="speech.content"/>
    </element>
  </define>
  <define name="speech.content">
    <optional>
      <ref name="speaker"/>
    </optional>
    <optional>
      <ref name="stage"/>
    </optional>
    <oneOrMore>
      <ref name="p"/>
    </oneOrMore>
  </define>
  <!-- ~~~~~~ speaker -->
  <define name="speaker">
    <element name="speaker">
      <ref name="speaker.content"/>
    </element>
  </define>
  <define name="speaker.content">
    <ref name="inlines"/>
  </define>
  <!-- ~~~~~~ stage -->
  <define name="stage">
    <element name="stage">
      <ref name="stage.content"/>
    </element>
  </define>
  <define name="stage.content">
    <ref name="inlines"/>
  </define>
  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ list ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
  <!-- ~~~~~~ list -->
  <define name="list">
    <element name="list">
      <ref name="list.content"/>
    </element>
  </define>
  <define name="list.content">
    <optional>
      <ref name="block.head"/>
    </optional>
    <choice>
      <group>
        <optional>
          <attribute name="type">
            <value>ordered</value>
          </attribute>
        </optional>
        <ref name="item"/>
        <oneOrMore>
          <ref name="item"/>
        </oneOrMore>
      </group>
      <group>
        <attribute name="type">
          <value>glossary</value>
        </attribute>
        <oneOrMore>
          <ref name="glossary.item"/>
        </oneOrMore>
      </group>
    </choice>
  </define>
  <!-- ~~~~~~ item -->
  <define name="item">
    <element name="item">
      <ref name="item.content"/>
    </element>
  </define>
  <define name="item.content">
    <choice>
      <ref name="inlines"/>
      <oneOrMore>
        <ref name="block"/>
      </oneOrMore>
    </choice>
  </define>
  <!-- ~~~~~~ glossary.item -->
  <define name="glossary.item">
    <element name="item">
      <ref name="glossary.item.content"/>
    </element>
  </define>
  <define name="glossary.item.content">
    <ref name="label"/>
    <oneOrMore>
      <ref name="block"/>
    </oneOrMore>
  </define>
  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ blockquote ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
  <!-- ~~~~~~ blockquote -->
  <define name="blockquote">
    <element name="blockquote">
      <ref name="blockquote.content"/>
    </element>
  </define>
  <define name="blockquote.content">
    <optional>
      <ref name="block.head"/>
    </optional>
    <oneOrMore>
      <choice>
        <ref name="p"/>
        <ref name="speech"/>
        <ref name="list"/>
      </choice>
    </oneOrMore>
    <optional>
      <ref name="attribution"/>
    </optional>
  </define>
  <!-- ~~~~~~ attribution -->
  <define name="attribution">
    <element name="attribution">
      <ref name="attribtuion.content"/>
    </element>
  </define>
  <define name="attribtuion.content">
    <ref name="inlines"/>
  </define>
  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ table ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
  <define name="table">
    <element name="table">
      <ref name="table.content"/>
    </element>
  </define>
  <define name="table.content">
    <optional>
      <ref name="block.head"/>
    </optional>
    <oneOrMore>
      <ref name="tgroup"/>
    </oneOrMore>
    <optional>
      <ref name="caption"/>
    </optional>
  </define>
  <!-- ~~~~~~ tgroup -->
  <define name="tgroup">
    <element name="tgroup">
      <ref name="tgroup.attributes"/>
      <ref name="tgroup.content"/>
    </element>
  </define>
  <define name="tgroup.content">
    <optional>
      <ref name="thead"/>
    </optional>
    <optional>
      <ref name="tfoot"/>
    </optional>
    <ref name="tbody"/>
  </define>
  <define name="tgroup.attributes">
    <interleave>
      <ref name="cols.attribute"/>
      <optional>
        <ref name="align.attribute"/>
      </optional>
      <optional>
        <ref name="colsep.attribute"/>
      </optional>
      <optional>
        <ref name="rowsep.attribute"/>
      </optional>
    </interleave>
  </define>
  <define name="cols.attribute">
    <attribute name="cols">
      <data type="positiveInteger"/>
    </attribute>
  </define>
  <define name="align.attribute">
    <attribute name="align">
      <choice>
        <value>left</value>
        <value>right</value>
        <value>center</value>
        <value>justify</value>
      </choice>
    </attribute>
  </define>
  <define name="colsep.attribute">
    <attribute name="colsep">
      <choice>
        <value>0</value>
        <value>1</value>
      </choice>
    </attribute>
  </define>
  <define name="rowsep.attribute">
    <attribute name="rowsep">
      <choice>
        <value>0</value>
        <value>1</value>
      </choice>
    </attribute>
  </define>
  <!-- ~~~~~~ thead, tfoot, tbody -->
  <define name="thead">
    <element name="thead">
      <ref name="thead.attributes"/>
      <ref name="thead.content"/>
    </element>
  </define>
  <define name="tfoot">
    <element name="tfoot">
      <ref name="tfoot.attributes"/>
      <ref name="tfoot.content"/>
    </element>
  </define>
  <define name="tbody">
    <element name="tbody">
      <ref name="tbody.attributes"/>
      <ref name="tbody.content"/>
    </element>
  </define>
  <define name="thead.attributes">
    <optional>
      <ref name="valign.attribute"/>
    </optional>
  </define>
  <define name="tfoot.attributes">
    <optional>
      <ref name="valign.attribute"/>
    </optional>
  </define>
  <define name="tbody.attributes">
    <optional>
      <ref name="valign.attribute"/>
    </optional>
  </define>
  <define name="valign.attribute">
    <attribute name="valign">
      <choice>
        <value>top</value>
        <value>middle</value>
        <value>bottom</value>
      </choice>
    </attribute>
  </define>
  <define name="thead.content">
    <oneOrMore>
      <ref name="row"/>
    </oneOrMore>
  </define>
  <define name="tfoot.content">
    <oneOrMore>
      <ref name="row"/>
    </oneOrMore>
  </define>
  <define name="tbody.content">
    <oneOrMore>
      <ref name="row"/>
    </oneOrMore>
  </define>
  <!-- ~~~~~~ row -->
  <define name="row">
    <element name="row">
      <ref name="row.attribute"/>
      <ref name="row.content"/>
    </element>
  </define>
  <define name="row.attribute">
    <optional>
      <ref name="valign.attribute"/>
    </optional>
  </define>
  <define name="row.content">
    <oneOrMore>
      <ref name="entry"/>
    </oneOrMore>
  </define>
  <!-- ~~~~~~ entry -->
  <define name="entry">
    <element name="entry">
      <ref name="entry.content"/>
    </element>
  </define>
  <define name="entry.content">
    <choice>
      <ref name="inlines"/>
      <oneOrMore>
        <choice>
          <ref name="p"/>
          <ref name="media"/>
        </choice>
      </oneOrMore>
    </choice>
  </define>
  <!-- ~~~~~~ caption -->
  <define name="caption">
    <element name="caption">
      <ref name="caption.content"/>
    </element>
  </define>
  <define name="caption.content">
    <choice>
      <ref name="inlines"/>
      <oneOrMore>
        <ref name="p"/>
      </oneOrMore>
    </choice>
  </define>
  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ media ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
  <!-- ~~~~~~ media -->
  <define name="media">
    <element name="media">
      <ref name="media.content"/>
    </element>
  </define>
  <define name="media.content">
    <optional>
      <ref name="block.head"/>
    </optional>
    <oneOrMore>
      <choice>
        <ref name="image"/>
        <ref name="audio"/>
      </choice>
    </oneOrMore>
    <optional>
      <ref name="caption"/>
    </optional>
    <optional>
      <ref name="link"/>
    </optional>
  </define>
  <!-- ~~~~~~ image -->
  <define name="image">
    <element name="image">
      <ref name="image.attributes"/>
      <ref name="image.content"/>
    </element>
  </define>
  <define name="image.attributes">
    <ref name="media.id.attribute"/>
    <optional>
      <ref name="image.type"/>
    </optional>
  </define>
  <define name="media.id.attribute">
    <attribute name="id">
      <data type="NMTOKEN"/>
    </attribute>
  </define>
  <define name="image.type">
    <attribute name="type">
      <choice>
        <value>cover</value>
        <value>thumbnail</value>
      </choice>
    </attribute>
  </define>
  <define name="image.content">
    <optional>
      <ref name="copyright"/>
    </optional>
  </define>
  <!-- ~~~~~~ audio -->
  <define name="audio">
    <element name="audio">
      <ref name="audio.attributes"/>
    </element>
  </define>
  <define name="audio.attributes">
    <ref name="media.id.attribute"/>
  </define>
  <!--
    =============================================================================
                                    INLINE LEVEL
    =============================================================================
  -->
  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ inlines ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
  <define name="inlines">
    <mixed>
      <interleave>
        <zeroOrMore>
          <ref name="sup"/>
        </zeroOrMore>
        <zeroOrMore>
          <ref name="sub"/>
        </zeroOrMore>
        <zeroOrMore>
          <ref name="var"/>
        </zeroOrMore>
        <zeroOrMore>
          <ref name="number"/>
        </zeroOrMore>
        <zeroOrMore>
          <ref name="math"/>
        </zeroOrMore>
        <zeroOrMore>
          <ref name="date"/>
        </zeroOrMore>
        <zeroOrMore>
          <ref name="name"/>
        </zeroOrMore>
        <zeroOrMore>
          <ref name="note"/>
        </zeroOrMore>
        <zeroOrMore>
          <ref name="foreign"/>
        </zeroOrMore>
        <zeroOrMore>
          <ref name="highlight"/>
        </zeroOrMore>
        <zeroOrMore>
          <ref name="mentioned"/>
        </zeroOrMore>
        <zeroOrMore>
          <ref name="quote"/>
        </zeroOrMore>
        <zeroOrMore>
          <ref name="acronym"/>
        </zeroOrMore>
        <zeroOrMore>
          <ref name="term"/>
        </zeroOrMore>
        <zeroOrMore>
          <ref name="link"/>
        </zeroOrMore>
        <zeroOrMore>
          <ref name="anchor"/>
        </zeroOrMore>
      </interleave>
    </mixed>
  </define>
  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub, sup, var ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
  <define name="sup">
    <element name="sup">
      <text/>
    </element>
  </define>
  <define name="sub">
    <element name="sub">
      <text/>
    </element>
  </define>
  <define name="var">
    <element name="var">
      <text/>
    </element>
  </define>
  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ math ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
  <define name="math">
    <element name="math">
      <choice>
        <group>
          <attribute name="notation">
            <value>tex</value>
          </attribute>
          <ref name="math.attributes"/>
          <ref name="math.tex.content"/>
        </group>
        <group>
          <ref name="math.attributes"/>
          <ref name="math.content"/>
        </group>
      </choice>
    </element>
  </define>
  <define name="math.attributes">
    <optional>
      <ref name="wide.attribute"/>
    </optional>
  </define>
  <define name="wide.attribute">
    <attribute name="wide">
      <data type="boolean"/>
    </attribute>
  </define>
  <define name="math.content">
    <mixed>
      <interleave>
        <zeroOrMore>
          <ref name="sup"/>
        </zeroOrMore>
        <zeroOrMore>
          <ref name="sub"/>
        </zeroOrMore>
        <zeroOrMore>
          <ref name="var"/>
        </zeroOrMore>
      </interleave>
    </mixed>
  </define>
  <define name="math.tex.content">
    <text/>
  </define>
  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ number ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
  <define name="number">
    <element name="number">
      <choice>
        <group>
          <attribute name="type">
            <value>roman</value>
          </attribute>
          <ref name="number.attributes"/>
          <ref name="number.roman.content"/>
        </group>
        <group>
          <ref name="number.attributes"/>
          <ref name="number.content"/>
        </group>
      </choice>
    </element>
  </define>
  <define name="number.attributes">
    <optional>
      <ref name="number.value.attribute"/>
    </optional>
  </define>
  <define name="number.value.attribute">
    <attribute name="value">
      <choice>
        <data type="integer"/>
        <data type="decimal"/>
      </choice>
    </attribute>
  </define>
  <define name="number.content">
    <mixed>
      <zeroOrMore>
        <ref name="sup"/>
      </zeroOrMore>
    </mixed>
  </define>
  <define name="number.roman.content">
    <data type="token">
      <param name="pattern">[dlxvi]+</param>
    </data>
  </define>
  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ date ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
  <define name="date">
    <element name="date">
      <ref name="date.attributes"/>
      <ref name="date.content"/>
    </element>
  </define>
  <define name="date.attributes">
    <interleave>
      <ref name="date.value.attribute"/>
      <optional>
        <ref name="date.of.attribute"/>
      </optional>
    </interleave>
  </define>
  <define name="date.value.attribute">
    <attribute name="value">
      <choice>
        <data type="date"/>
        <data type="gYearMonth"/>
        <data type="gYear"/>
      </choice>
    </attribute>
  </define>
  <define name="date.of.attribute">
    <attribute name="of">
      <choice>
        <value>birth</value>
        <value>death</value>
      </choice>
    </attribute>
  </define>
  <define name="date.content">
    <mixed>
      <zeroOrMore>
        <ref name="sup"/>
      </zeroOrMore>
    </mixed>
  </define>
  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ name ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
  <define name="name">
    <element name="name">
      <ref name="name.attributes"/>
      <ref name="name.content"/>
    </element>
  </define>
  <define name="name.attributes">
    <optional>
      <ref name="name.of.attribute"/>
    </optional>
  </define>
  <define name="name.of.attribute">
    <attribute name="of">
      <choice>
        <value>person</value>
        <value>company</value>
        <value>book</value>
        <value>newspaper</value>
        <value>party</value>
      </choice>
    </attribute>
  </define>
  <define name="name.content">
    <ref name="inlines"/>
  </define>
  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ note ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
  <define name="note">
    <element name="note">
      <ref name="note.attributes"/>
      <ref name="note.content"/>
    </element>
  </define>
  <define name="note.attributes">
    <optional>
      <ref name="note.label.attribute"/>
    </optional>
  </define>
  <define name="note.label.attribute">
    <attribute name="label"/>
  </define>
  <define name="note.content">
    <choice>
      <ref name="inlines"/>
      <oneOrMore>
        <ref name="p"/>
      </oneOrMore>
    </choice>
  </define>
  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ foreign ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
  <define name="foreign">
    <element name="foreign">
      <ref name="foreign.attributes"/>
      <ref name="foreign.content"/>
    </element>
  </define>
  <define name="foreign.attributes">
    <optional>
      <ref name="lang.attribute"/>
    </optional>
  </define>
  <define name="foreign.content">
    <ref name="inlines"/>
  </define>
  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ highlight ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
  <define name="highlight">
    <element name="highlight">
      <ref name="highlight.content"/>
    </element>
  </define>
  <define name="highlight.content">
    <ref name="inlines"/>
  </define>
  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ mentioned ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
  <define name="mentioned">
    <element name="mentioned">
      <ref name="mentioned.content"/>
    </element>
  </define>
  <define name="mentioned.content">
    <ref name="inlines"/>
  </define>
  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ quote ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
  <define name="quote">
    <element name="quote">
      <ref name="quote.content"/>
    </element>
  </define>
  <define name="quote.content">
    <ref name="inlines"/>
  </define>
  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ acronym ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
  <define name="acronym">
    <element name="acronym">
      <ref name="acronym.content"/>
    </element>
  </define>
  <define name="acronym.content">
    <ref name="inlines"/>
  </define>
  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ term ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
  <define name="term">
    <element name="term">
      <ref name="term.content"/>
    </element>
  </define>
  <define name="term.content">
    <ref name="inlines"/>
  </define>
  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ link ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
  <define name="link">
    <element name="link">
      <ref name="link.attributes"/>
      <ref name="link.content"/>
    </element>
  </define>
  <define name="link.attributes">
    <choice>
      <ref name="uri.attribute"/>
      <ref name="idref.attribute"/>
    </choice>
  </define>
  <define name="uri.attribute">
    <attribute name="uri">
      <data type="anyURI"/>
    </attribute>
  </define>
  <define name="idref.attribute">
    <attribute name="idref">
      <data type="IDREF"/>
    </attribute>
  </define>
  <define name="link.content">
    <ref name="inlines"/>
  </define>
  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ anchor ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
  <define name="anchor">
    <element name="anchor">
      <ref name="anchor.attributes"/>
    </element>
  </define>
  <define name="anchor.attributes">
    <ref name="anchor.id.attribute"/>
  </define>
  <define name="anchor.id.attribute">
    <attribute name="xml:id">
      <data type="ID"/>
    </attribute>
  </define>
</grammar>