Première version de CALS
authorPatrick PIERRE <patrick.pierre@prismallia.fr>
sam., 11 juin 2011 20:35:18 +0200
changeset 17 ca367d4d080b
parent 15 341a2845bc0b
child 18 e448c6a000e5
Première version de CALS
RelaxNG/publidoc.rnc
RelaxNG/publidoc.rng
--- a/RelaxNG/publidoc.rnc	sam. juin 11 18:01:26 2011 +0200
+++ b/RelaxNG/publidoc.rnc	sam. juin 11 20:35:18 2011 +0200
@@ -216,9 +216,9 @@
 #                                 Block level
 # =============================================================================
 
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ blocks ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ block ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-block = (parag | \list | speech | media)
+block = (parag | \list | table | speech | media)
 
 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ parag ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
@@ -228,7 +228,7 @@
    inlines
  & link*
 
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ list ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ list ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 # ~~~~~~ list
 \list = element list { \list.content }
@@ -255,6 +255,68 @@
 
 label.content = inlines
 
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ table ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+table = element table { table.content }
+
+table.content =
+   title?,
+   tgroup+,
+   caption?
+
+# ~~~~~~ tgroup
+tgroup = element tgroup { tgroup.attributes, tgroup.content }
+
+tgroup.content =
+   thead?,
+   tfoot?,
+   tbody
+
+tgroup.attributes =
+   cols.attribute
+ & align.attribute?
+ & colsep.attribute?
+ & rowsep.attribute?
+cols.attribute = attribute cols { xsd:positiveInteger }
+align.attribute = attribute align { "left"  |  "right"  | "center" | "justify" }
+colsep.attribute = attribute colsep { "0" | "1" }
+rowsep.attribute = attribute rowsep { "0" | "1" }
+
+# ~~~~~~ thead, tfoot, tbody
+thead = element thead { thead.content }
+tfoot = element tfoot { tfoot.content }
+tbody = element tbody { tbody.content }
+
+thead.content =
+   row+
+tfoot.content =
+   row+
+tbody.content =
+   row+
+
+# ~~~~~~ row
+row = element row { row.attribute, row.content }
+
+row.attribute =
+   valign.attribute?
+valign.attribute = attribute valign { "top" | "middle" | "bottom" }
+
+row.content =
+  entry+
+
+# ~~~~~~ entry
+entry = element entry { entry.content }
+
+entry.content =
+   inlines
+ | parag+
+
+# ~~~~~~ caption
+caption = element caption { caption.content }
+
+caption.content =
+   parag+
+
 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ speech ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 # ~~~~~~ speech
@@ -282,25 +344,18 @@
 
 media.content =
    image+,
-   media.caption?
-
-media.id.attribute = attribute id { xsd:NMTOKEN }
+   caption?
 
 # ~~~~~~ image
 image = element image { image.attributes, image.content }
 
 image.attributes =
    media.id.attribute
+media.id.attribute = attribute id { xsd:NMTOKEN }
 
 image.content =
    copyright?
 
-# ~~~~~~ caption
-media.caption = element caption { media.caption.content }
-
-media.caption.content =
-   parag+
-
 # ~~~~~~ copyright
 copyright = element copyright { copyright.content }
 
@@ -381,7 +436,8 @@
 note.label.attribute = attribute label { text }
 
 note.content =
-   parag+
+   inlines
+ | parag+
 
 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ foreign ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
--- a/RelaxNG/publidoc.rng	sam. juin 11 18:01:26 2011 +0200
+++ b/RelaxNG/publidoc.rng	sam. juin 11 20:35:18 2011 +0200
@@ -400,11 +400,12 @@
                                     Block level
     =============================================================================
   -->
-  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ blocks ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ block ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
   <define name="block">
     <choice>
       <ref name="parag"/>
       <ref name="list"/>
+      <ref name="table"/>
       <ref name="speech"/>
       <ref name="media"/>
     </choice>
@@ -423,7 +424,7 @@
       </zeroOrMore>
     </interleave>
   </define>
-  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ list ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ list ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
   <!-- ~~~~~~ list -->
   <define name="list">
     <element name="list">
@@ -488,6 +489,166 @@
   <define name="label.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="title"/>
+    </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.content"/>
+    </element>
+  </define>
+  <define name="tfoot">
+    <element name="tfoot">
+      <ref name="tfoot.content"/>
+    </element>
+  </define>
+  <define name="tbody">
+    <element name="tbody">
+      <ref name="tbody.content"/>
+    </element>
+  </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="valign.attribute">
+    <attribute name="valign">
+      <choice>
+        <value>top</value>
+        <value>middle</value>
+        <value>bottom</value>
+      </choice>
+    </attribute>
+  </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>
+        <ref name="parag"/>
+      </oneOrMore>
+    </choice>
+  </define>
+  <!-- ~~~~~~ caption -->
+  <define name="caption">
+    <element name="caption">
+      <ref name="caption.content"/>
+    </element>
+  </define>
+  <define name="caption.content">
+    <oneOrMore>
+      <ref name="parag"/>
+    </oneOrMore>
+  </define>
   <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ speech ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
   <!-- ~~~~~~ speech -->
   <define name="speech">
@@ -536,14 +697,9 @@
       <ref name="image"/>
     </oneOrMore>
     <optional>
-      <ref name="media.caption"/>
+      <ref name="caption"/>
     </optional>
   </define>
-  <define name="media.id.attribute">
-    <attribute name="id">
-      <data type="NMTOKEN"/>
-    </attribute>
-  </define>
   <!-- ~~~~~~ image -->
   <define name="image">
     <element name="image">
@@ -554,22 +710,16 @@
   <define name="image.attributes">
     <ref name="media.id.attribute"/>
   </define>
+  <define name="media.id.attribute">
+    <attribute name="id">
+      <data type="NMTOKEN"/>
+    </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">
@@ -768,9 +918,12 @@
     <attribute name="label"/>
   </define>
   <define name="note.content">
-    <oneOrMore>
-      <ref name="parag"/>
-    </oneOrMore>
+    <choice>
+      <ref name="inlines"/>
+      <oneOrMore>
+        <ref name="parag"/>
+      </oneOrMore>
+    </choice>
   </define>
   <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ foreign ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
   <define name="foreign">