<?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="metadata"/>
</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="topic.content"/>
</element>
</define>
<!--
=============================================================================
Metadata level
=============================================================================
-->
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ metadata ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<define name="metadata">
<element name="metadata">
<ref name="metadata.content"/>
</element>
</define>
<define name="metadata.content">
<interleave>
<ref name="title"/>
<optional>
<ref name="subtitle"/>
</optional>
<zeroOrMore>
<ref name="author"/>
</zeroOrMore>
<optional>
<ref name="publisher"/>
</optional>
<optional>
<ref name="language"/>
</optional>
<optional>
<ref name="date"/>
</optional>
<optional>
<ref name="place"/>
</optional>
<zeroOrMore>
<ref name="source"/>
</zeroOrMore>
<optional>
<ref name="subjectset"/>
</optional>
<optional>
<ref name="abstract"/>
</optional>
<zeroOrMore>
<ref name="annotation"/>
</zeroOrMore>
</interleave>
</define>
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ title, subtitle ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<define name="title">
<element name="title">
<ref name="title.content"/>
</element>
</define>
<define name="title.content">
<ref name="inlines"/>
</define>
<define name="subtitle">
<element name="subtitle">
<ref name="title.content"/>
</element>
</define>
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ author, publisher ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<define name="author">
<element name="author">
<ref name="author.content"/>
</element>
</define>
<define name="author.content">
<optional>
<ref name="firstname"/>
</optional>
<ref name="lastname"/>
</define>
<define name="publisher">
<element name="publisher">
<ref name="publisher.content"/>
</element>
</define>
<define name="publisher.content">
<ref name="inlines"/>
</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>
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 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">
<ref name="source.attributes"/>
<choice>
<group>
<attribute name="type">
<value>book</value>
</attribute>
<ref name="source.content.book"/>
</group>
<attribute name="type">
<value>file</value>
</attribute>
</choice>
<ref name="source.content"/>
</element>
</define>
<define name="source.attributes">
<ref name="source.id.attribute"/>
</define>
<define name="source.id.attribute">
<attribute name="id">
<data type="NMTOKEN"/>
</attribute>
</define>
<define name="source.content.book">
<ref name="title"/>
<zeroOrMore>
<ref name="pagenumber"/>
</zeroOrMore>
</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">
<ref name="pagenumber.value.enumeration"/>
</attribute>
</define>
<define name="pagenumber.value.enumeration">
<data type="positiveInteger"/>
</define>
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ subject ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<!-- ~~~~~~ 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="parag"/>
</oneOrMore>
</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="metadata"/>
</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="top.topic.attributes">
<interleave>
<ref name="topic.id.attribute"/>
<optional>
<ref name="topic.type.attribute"/>
</optional>
</interleave>
</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.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="topic.content">
<optional>
<ref name="metadata"/>
</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="metadata"/>
</optional>
<choice>
<oneOrMore>
<ref name="section"/>
</oneOrMore>
<oneOrMore>
<choice>
<ref name="parag"/>
<ref name="media"/>
</choice>
</oneOrMore>
</choice>
</define>
<define name="section.attributes">
<optional>
<ref name="status.attribute"/>
</optional>
</define>
<define name="status.attribute">
<attribute name="status">
<data type="NCName"/>
</attribute>
</define>
<!--
=============================================================================
Block level
=============================================================================
-->
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ parag ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<define name="parag">
<element name="parag">
<ref name="parag.content"/>
</element>
</define>
<define name="parag.content">
<interleave>
<ref name="inlines"/>
<zeroOrMore>
<ref name="link"/>
</zeroOrMore>
</interleave>
</define>
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ media ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<!-- ~~~~~~ media -->
<define name="media">
<element name="media">
<ref name="media.content"/>
</element>
</define>
<define name="media.content">
<oneOrMore>
<ref name="image"/>
</oneOrMore>
<optional>
<ref name="media.caption"/>
</optional>
</define>
<define name="media.id.attribute">
<attribute name="id">
<data type="NMTOKEN"/>
</attribute>
</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"/>
</define>
<define name="image.content">
<optional>
<ref name="copyright"/>
</optional>
</define>
<!-- ~~~~~~ caption -->
<define name="media.caption">
<element name="caption">
<ref name="media.caption.content"/>
</element>
</define>
<define name="media.caption.content">
<oneOrMore>
<ref name="parag"/>
</oneOrMore>
</define>
<!-- ~~~~~~ copyright -->
<define name="copyright">
<element name="copyright">
<ref name="copyright.content"/>
</element>
</define>
<define name="copyright.content">
<ref name="inlines"/>
</define>
<!--
=============================================================================
Inline level
=============================================================================
-->
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ inlines ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<define name="inlines">
<mixed>
<interleave>
<zeroOrMore>
<ref name="sup"/>
</zeroOrMore>
<zeroOrMore>
<ref name="sub"/>
</zeroOrMore>
<zeroOrMore>
<ref name="romannum"/>
</zeroOrMore>
<zeroOrMore>
<ref name="date"/>
</zeroOrMore>
<zeroOrMore>
<ref name="name"/>
</zeroOrMore>
<zeroOrMore>
<ref name="footnote"/>
</zeroOrMore>
<zeroOrMore>
<ref name="foreign"/>
</zeroOrMore>
<zeroOrMore>
<ref name="highlight"/>
</zeroOrMore>
</interleave>
</mixed>
</define>
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub, sup ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<define name="sup">
<element name="sup">
<ref name="inlines"/>
</element>
</define>
<define name="sub">
<element name="sub">
<ref name="inlines"/>
</element>
</define>
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ romannum ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<define name="romannum">
<element name="romannum">
<data type="token">
<param name="pattern">([dlxvi]+)</param>
</data>
</element>
</define>
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ date ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<define name="date">
<element name="date">
<ref name="date.attributes"/>
<ref name="date.content"/>
</element>
</define>
<define name="date.attributes">
<ref name="date.of.attribute"/>
</define>
<define name="date.of.attribute">
<attribute name="of">
<ref name="date.of.enumeration"/>
</attribute>
</define>
<define name="date.of.enumeration">
<choice>
<value>event</value>
<value>birth</value>
<value>death</value>
</choice>
</define>
<define name="date.content">
<choice>
<data type="date"/>
<data type="gYearMonth"/>
<data type="gYear"/>
</choice>
</define>
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ name ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<define name="firstname">
<element name="firstname">
<ref name="inlines"/>
</element>
</define>
<define name="lastname">
<element name="lastname">
<ref name="inlines"/>
</element>
</define>
<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">
<ref name="name.of.enumeration"/>
</attribute>
</define>
<define name="name.of.enumeration">
<choice>
<value>person</value>
<value>company</value>
<value>book</value>
<value>newspaper</value>
<value>party</value>
</choice>
</define>
<define name="name.content">
<ref name="inlines"/>
</define>
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ footnote ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<define name="footnote">
<element name="footnote">
<ref name="footnote.attributes"/>
<ref name="footnote.content"/>
</element>
</define>
<define name="footnote.attributes">
<optional>
<ref name="footnote.label.attribute"/>
</optional>
</define>
<define name="footnote.label.attribute">
<attribute name="label"/>
</define>
<define name="footnote.content">
<oneOrMore>
<ref name="parag"/>
</oneOrMore>
</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>
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ link ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<define name="link">
<element name="link">
<ref name="link.attributes"/>
<ref name="link.content"/>
</element>
</define>
<define name="link.attributes">
<empty/>
</define>
<define name="link.content">
<ref name="inlines"/>
</define>
</grammar>