Merge
authorPatrick PIERRE <patrick.pierre@prismallia.fr>
dim., 12 juin 2011 14:28:07 +0200
changeset 19 7141fd097b97
parent 18 e448c6a000e5 (diff)
parent 16 afd2fe442c65 (current diff)
child 20 79713ffae179
Merge
Xml/Documents/torture_test.xml
--- a/RelaxNG/publidoc.rnc	sam. juin 11 20:34:05 2011 +0200
+++ b/RelaxNG/publidoc.rnc	dim. juin 12 14:28:07 2011 +0200
@@ -30,12 +30,12 @@
 document.id.attribute = attribute xml:id { xsd:ID }
 
 document.content =
-   metadata?,
+   top.metadata?,
    (division+ | topic+)
 
 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ topic ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-top.topic = element topic { top.topic.attributes, topic.content }
+top.topic = element topic { top.topic.attributes, top.topic.content }
 
 
 # =============================================================================
@@ -44,28 +44,49 @@
 
 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ metadata ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-metadata = element metadata { metadata.content }
+top.metadata = element metadata { top.metadata.content }
+division.metadata = element metadata { division.metadata.content }
+component.metadata = element metadata { component.metadata.content }
+section.metadata = element metadata { section.metadata.content }
 
-metadata.content =
-   title
- & subtitle?
+top.metadata.content =
+   (title, subtitle?)?
+ & language?
  & author*
  & publisher?
- & language?
  & date?
  & place?
  & source*
  & subjectset?
  & abstract?
  & annotation*
+division.metadata.content =
+   (title, subtitle?)?
+ & language?
+ & annotation*
+component.metadata.content =
+   (title, subtitle?)?
+ & language?
+ & author*
+ & annotation*
+section.metadata.content =
+   (title, subtitle?)?
+ & language?
+ & annotation*
 
 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ title, subtitle ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 title = element title { title.content }
+subtitle = element subtitle { title.content }
 
 title.content = inlines
 
-subtitle = element subtitle { title.content }
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ language ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+language = element language { language.attributes }
+
+language.attributes = lang.attribute
+lang.attribute = attribute xml:lang { xsd:language }
 
 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ author, publisher ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
@@ -91,13 +112,6 @@
 
 lastname.content = inlines
 
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Language ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-language = element language { language.attributes }
-
-language.attributes = lang.attribute
-lang.attribute = attribute xml:lang { xsd:language }
-
 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ place ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 place = element place { place.content }
@@ -169,7 +183,7 @@
 division = element division { division.content }
 
 division.content =
-   metadata?,
+   division.metadata?,
    (division+ | topic+)
 
 
@@ -190,8 +204,11 @@
 topic.id.attribute = attribute xml:id { xsd:ID }
 topic.type.attribute = attribute type { xsd:NCName }
 
+top.topic.content =
+   top.metadata?,
+   section+
 topic.content =
-   metadata?,
+   component.metadata?,
    section+
 
 
@@ -204,7 +221,7 @@
 section = element section { section.content, section.attributes }
 
 section.content =
-   metadata?,
+   section.metadata?,
    (section+ | block+)
 
 section.attributes =
@@ -216,9 +233,9 @@
 #                                 Block level
 # =============================================================================
 
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ blocks ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ block ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-block = (parag | \list | speech | media)
+block = (parag | speech | \list | table | media)
 
 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ parag ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
@@ -228,7 +245,27 @@
    inlines
  & link*
 
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ list ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ speech ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+# ~~~~~~ speech
+speech = element speech { speech.content }
+
+speech.content =
+   speaker?,
+   stage?,
+   parag+
+
+# ~~~~~~ speaker
+speaker = element speaker { speaker.content }
+
+speaker.content = inlines
+
+# ~~~~~~ stage
+stage = element stage { stage.content }
+
+stage.content = inlines
+
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ list ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 # ~~~~~~ list
 \list = element list { \list.content }
@@ -255,26 +292,68 @@
 
 label.content = inlines
 
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ speech ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ table ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-# ~~~~~~ speech
-speech = element speech { speech.content }
+table = element table { table.content }
 
-speech.content =
-   speaker?,
-   stage?,
+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+
 
-# ~~~~~~ speaker
-speaker = element speaker { speaker.content }
-
-speaker.content = inlines
-
-# ~~~~~~ stage
-stage = element stage { stage.content }
-
-stage.content = inlines
-
 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ media ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 # ~~~~~~ media
@@ -282,25 +361,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 +453,8 @@
 note.label.attribute = attribute label { text }
 
 note.content =
-   parag+
+   inlines
+ | parag+
 
 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ foreign ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
--- a/RelaxNG/publidoc.rng	sam. juin 11 20:34:05 2011 +0200
+++ b/RelaxNG/publidoc.rng	dim. juin 12 14:28:07 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">
--- a/RelaxNG/publiset.rnc	sam. juin 11 20:34:05 2011 +0200
+++ b/RelaxNG/publiset.rnc	dim. juin 12 14:28:07 2011 +0200
@@ -70,20 +70,25 @@
    remap.attributes
 
 metadata.content =
-   title?
- & subtitle?
+   (title, subtitle?)?
+ & language?
  & author*
  & publisher?
- & language?
  & source?
 
 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ title, subtitle ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 title = element title { title.content }
+subtitle = element subtitle { title.content }
 
 title.content = inlines
 
-subtitle = element subtitle { title.content }
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ language ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+language = element language { language.attributes }
+
+language.attributes = lang.attribute
+lang.attribute = attribute xml:lang { xsd:language }
 
 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ author, publisher ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
@@ -109,13 +114,6 @@
 
 lastname.content = inlines
 
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Language ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-language = element language { language.attributes }
-
-language.attributes = lang.attribute
-lang.attribute = attribute xml:lang { xsd:language }
-
 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ source ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 # ~~~~~~ source
--- a/Xml/Documents/demi-douce.xml	sam. juin 11 20:34:05 2011 +0200
+++ b/Xml/Documents/demi-douce.xml	dim. juin 12 14:28:07 2011 +0200
@@ -5,11 +5,11 @@
     <metadata>
       <title>La demi-douce</title>
       <subtitle>Récit</subtitle>
+      <language xml:lang="fr"/>
       <author>
         <firstname>Henri</firstname><lastname>Ostrowiecki</lastname>
       </author>
       <publisher>Les éditions des Rosiers</publisher>
-      <language xml:lang="fr"/>
       <abstract>
         <parag>
           C'est l'histoire d'un petit garçon qui faillit ne jamais avoir 5 ans
--- a/Xml/Documents/torture_test.xml	sam. juin 11 20:34:05 2011 +0200
+++ b/Xml/Documents/torture_test.xml	dim. juin 12 14:28:07 2011 +0200
@@ -44,9 +44,6 @@
           <metadata>
             <title>Les misérables</title>
             <subtitle>Extrait</subtitle>
-            <author>
-              <firstname>Victor</firstname><lastname>HUGO</lastname>
-            </author>
           </metadata>
           <parag>
             Cosette et Marius tombèrent à genoux, éperdus, étouffés de larmes,
@@ -69,6 +66,34 @@
       <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
       <topic>
         <metadata>
+          <title>Les dialogues</title>
+        </metadata>
+        <section>
+          <metadata>
+            <title>Cyrano de Bergerac</title>
+            <subtitle>Extrait</subtitle>
+          </metadata>
+          <speech>
+            <speaker>Le fâcheux</speaker>
+            <parag>
+              Quoi, pas un grand seigneur pour couvrir de son nom ?…
+            </parag>
+          </speech>
+          <speech>
+            <speaker>Cyrano</speaker>
+            <stage>agacé</stage>
+            <parag>
+              Non, ai-je dit deux fois. Faut-il donc que je trisse ?…
+            </parag>
+            <parag>
+              Non, pas de protecteur…mais une protectrice !
+            </parag>
+          </speech>
+        </section>
+      </topic>
+      <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+      <topic>
+        <metadata>
           <title>Les listes</title>
         </metadata>
         <section>
@@ -140,7 +165,7 @@
       <topic>
         <metadata>
           <title>Les tableaux</title>
-        </metadata>
+       </metadata>
         <section>
           <table>
             <tgroup cols="3" align="left">
@@ -164,40 +189,15 @@
                 </row>
               </tbody>
             </tgroup>
+            <caption>
+              <parag>Légende du tableau</parag>
+            </caption>
           </table>
         </section>
       </topic>
       <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
       <topic>
         <metadata>
-          <title>Les dialogues</title>
-        </metadata>
-        <section>
-          <metadata>
-            <title>Cyrano de Bergerac</title>
-            <subtitle>Extrait</subtitle>
-          </metadata>
-          <speech>
-            <speaker>Le fâcheux</speaker>
-            <parag>
-              Quoi, pas un grand seigneur pour couvrir de son nom ?…
-            </parag>
-          </speech>
-          <speech>
-            <speaker>Cyrano</speaker>
-            <stage>agacé</stage>
-            <parag>
-              Non, ai-je dit deux fois. Faut-il donc que je trisse ?…
-            </parag>
-            <parag>
-              Non, pas de protecteur…mais une protectrice !
-            </parag>
-          </speech>
-        </section>
-      </topic>
-      <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
-      <topic>
-        <metadata>
           <title>Les medias</title>
         </metadata>
         <section>