RelaxNG/publidoc.rng
changeset 20 79713ffae179
parent 17 ca367d4d080b
child 22 94b8e4454c47
--- a/RelaxNG/publidoc.rng	dim. juin 12 14:28:07 2011 +0200
+++ b/RelaxNG/publidoc.rng	dim. juin 12 15:21:35 2011 +0200
@@ -26,7 +26,7 @@
   </define>
   <!--
     =============================================================================
-                                     Top level
+                                     TOP LEVEL
     =============================================================================
   -->
   <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ document ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
@@ -46,7 +46,7 @@
   </define>
   <define name="document.content">
     <optional>
-      <ref name="metadata"/>
+      <ref name="top.head"/>
     </optional>
     <choice>
       <oneOrMore>
@@ -61,25 +61,76 @@
   <define name="top.topic">
     <element name="topic">
       <ref name="top.topic.attributes"/>
-      <ref name="topic.content"/>
+      <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>
   <!--
     =============================================================================
-                                  Metadata level
+                                    HEAD LEVEL
     =============================================================================
   -->
-  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ metadata ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
-  <define name="metadata">
-    <element name="metadata">
-      <ref name="metadata.content"/>
+  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ head ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+  <define name="top.head">
+    <element name="head">
+      <ref name="top.head.content"/>
     </element>
   </define>
-  <define name="metadata.content">
+  <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>
-      <ref name="title"/>
       <optional>
-        <ref name="subtitle"/>
+        <ref name="title"/>
+        <optional>
+          <ref name="subtitle"/>
+        </optional>
+      </optional>
+      <optional>
+        <ref name="language"/>
       </optional>
       <zeroOrMore>
         <ref name="author"/>
@@ -88,9 +139,6 @@
         <ref name="publisher"/>
       </optional>
       <optional>
-        <ref name="language"/>
-      </optional>
-      <optional>
         <ref name="date"/>
       </optional>
       <optional>
@@ -110,20 +158,93 @@
       </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>
+      <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>
+      <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="title.content">
-    <ref name="inlines"/>
-  </define>
   <define name="subtitle">
     <element name="subtitle">
       <ref name="title.content"/>
     </element>
   </define>
+  <define name="title.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>
   <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ author, publisher ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
   <!-- ~~~~~~ author -->
   <define name="author">
@@ -164,20 +285,6 @@
   <define name="lastname.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">
@@ -276,7 +383,7 @@
   </define>
   <define name="abstract.content">
     <oneOrMore>
-      <ref name="parag"/>
+      <ref name="p"/>
     </oneOrMore>
   </define>
   <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ annotation ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
@@ -290,7 +397,7 @@
   </define>
   <!--
     =============================================================================
-                                    Division level
+                                    DIVISION LEVEL
     =============================================================================
   -->
   <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ division ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
@@ -301,7 +408,7 @@
   </define>
   <define name="division.content">
     <optional>
-      <ref name="metadata"/>
+      <ref name="division.head"/>
     </optional>
     <choice>
       <oneOrMore>
@@ -314,7 +421,7 @@
   </define>
   <!--
     =============================================================================
-                                  Component level
+                                  COMPONENT LEVEL
     =============================================================================
   -->
   <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ topic ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
@@ -324,14 +431,6 @@
       <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>
@@ -342,19 +441,9 @@
       </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"/>
+      <ref name="component.head"/>
     </optional>
     <oneOrMore>
       <ref name="section"/>
@@ -362,10 +451,10 @@
   </define>
   <!--
     =============================================================================
-                                    Section level
+                                    SECTION LEVEL
     =============================================================================
   -->
-  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ section ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ section ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
   <define name="section">
     <element name="section">
       <ref name="section.content"/>
@@ -374,7 +463,7 @@
   </define>
   <define name="section.content">
     <optional>
-      <ref name="metadata"/>
+      <ref name="section.head"/>
     </optional>
     <choice>
       <oneOrMore>
@@ -397,26 +486,26 @@
   </define>
   <!--
     =============================================================================
-                                    Block level
+                                    BLOCK LEVEL
     =============================================================================
   -->
-  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ block ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ block ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
   <define name="block">
     <choice>
-      <ref name="parag"/>
+      <ref name="p"/>
+      <ref name="speech"/>
       <ref name="list"/>
       <ref name="table"/>
-      <ref name="speech"/>
       <ref name="media"/>
     </choice>
   </define>
-  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ parag ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
-  <define name="parag">
-    <element name="parag">
-      <ref name="parag.content"/>
+  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ p ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+  <define name="p">
+    <element name="p">
+      <ref name="p.content"/>
     </element>
   </define>
-  <define name="parag.content">
+  <define name="p.content">
     <interleave>
       <ref name="inlines"/>
       <zeroOrMore>
@@ -424,6 +513,42 @@
       </zeroOrMore>
     </interleave>
   </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">
@@ -433,7 +558,7 @@
   </define>
   <define name="list.content">
     <optional>
-      <ref name="title"/>
+      <ref name="block.head"/>
     </optional>
     <choice>
       <group>
@@ -497,7 +622,7 @@
   </define>
   <define name="table.content">
     <optional>
-      <ref name="title"/>
+      <ref name="block.head"/>
     </optional>
     <oneOrMore>
       <ref name="tgroup"/>
@@ -634,7 +759,7 @@
     <choice>
       <ref name="inlines"/>
       <oneOrMore>
-        <ref name="parag"/>
+        <ref name="p"/>
       </oneOrMore>
     </choice>
   </define>
@@ -645,45 +770,12 @@
     </element>
   </define>
   <define name="caption.content">
-    <oneOrMore>
-      <ref name="parag"/>
-    </oneOrMore>
-  </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="parag"/>
-    </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"/>
+    <choice>
+      <ref name="inlines"/>
+      <oneOrMore>
+        <ref name="p"/>
+      </oneOrMore>
+    </choice>
   </define>
   <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ media ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
   <!-- ~~~~~~ media -->
@@ -731,7 +823,7 @@
   </define>
   <!--
     =============================================================================
-                                    Inline level
+                                    INLINE LEVEL
     =============================================================================
   -->
   <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ inlines ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
@@ -921,7 +1013,7 @@
     <choice>
       <ref name="inlines"/>
       <oneOrMore>
-        <ref name="parag"/>
+        <ref name="p"/>
       </oneOrMore>
     </choice>
   </define>