RelaxNG/publidoc.rng
changeset 66 29c53c3d676e
parent 64 2d6627e9d3d6
child 69 52c72abcc57d
--- a/RelaxNG/publidoc.rng	ven. déc. 30 09:44:50 2011 +0100
+++ b/RelaxNG/publidoc.rng	jeu. janv. 05 20:10:05 2012 +0100
@@ -37,13 +37,23 @@
     </element>
   </define>
   <define name="document.attributes">
-    <ref name="document.id.attribute"/>
+    <interleave>
+      <ref name="document.id.attribute"/>
+      <optional>
+        <ref name="lang.attribute"/>
+      </optional>
+    </interleave>
   </define>
   <define name="document.id.attribute">
     <attribute name="xml:id">
       <data type="ID"/>
     </attribute>
   </define>
+  <define name="lang.attribute">
+    <attribute name="xml:lang">
+      <data type="language"/>
+    </attribute>
+  </define>
   <define name="document.content">
     <optional>
       <ref name="top.head"/>
@@ -68,6 +78,9 @@
       <optional>
         <ref name="topic.type.attribute"/>
       </optional>
+      <optional>
+        <ref name="lang.attribute"/>
+      </optional>
     </interleave>
   </define>
   <define name="topic.id.attribute">
@@ -131,16 +144,10 @@
         <ref name="identifier"/>
       </zeroOrMore>
       <optional>
-        <ref name="language"/>
+        <ref name="copyright"/>
       </optional>
       <optional>
-        <ref name="copyright"/>
-      </optional>
-      <zeroOrMore>
-        <ref name="author"/>
-      </zeroOrMore>
-      <optional>
-        <ref name="publisher"/>
+        <ref name="contributors"/>
       </optional>
       <optional>
         <ref name="date"/>
@@ -193,11 +200,8 @@
         </optional>
       </optional>
       <optional>
-        <ref name="language"/>
+        <ref name="contributors"/>
       </optional>
-      <zeroOrMore>
-        <ref name="author"/>
-      </zeroOrMore>
       <optional>
         <ref name="abstract"/>
       </optional>
@@ -269,20 +273,6 @@
       <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">
@@ -292,77 +282,101 @@
   <define name="copyright.content">
     <ref name="inlines"/>
   </define>
-  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ author, publisher ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
-  <!-- ~~~~~~ author -->
-  <define name="author">
-    <element name="author">
-      <ref name="author.content"/>
+  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ contributors ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+  <!-- ~~~~~~ contributors -->
+  <define name="contributors">
+    <element name="contributors">
+      <ref name="contributors.content"/>
     </element>
   </define>
-  <define name="author.content">
+  <define name="contributors.content">
+    <oneOrMore>
+      <ref name="contributor"/>
+    </oneOrMore>
+  </define>
+  <!-- ~~~~~~ contributor -->
+  <define name="contributor">
+    <element name="contributor">
+      <ref name="contributor.content"/>
+    </element>
+  </define>
+  <define name="contributor.content">
+    <choice>
+      <group>
+        <optional>
+          <ref name="firstname"/>
+          <optional>
+            <ref name="secondname"/>
+          </optional>
+        </optional>
+        <ref name="lastname"/>
+      </group>
+      <ref name="label"/>
+    </choice>
     <optional>
-      <ref name="firstname"/>
+      <ref name="address"/>
     </optional>
-    <ref name="lastname"/>
+    <optional>
+      <ref name="link"/>
+    </optional>
     <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 -->
+  <!-- ~~~~~~ firstname, secondname, lastname, label -->
   <define name="firstname">
     <element name="firstname">
       <ref name="firstname.content"/>
     </element>
   </define>
-  <define name="firstname.content">
-    <ref name="inlines"/>
+  <define name="secondname">
+    <element name="secondname">
+      <ref name="secondname.content"/>
+    </element>
   </define>
-  <!-- ~~~~~~ lastname -->
   <define name="lastname">
     <element name="lastname">
       <ref name="lastname.content"/>
     </element>
   </define>
+  <define name="label">
+    <element name="label">
+      <ref name="label.content"/>
+    </element>
+  </define>
+  <define name="firstname.content">
+    <ref name="inlines"/>
+  </define>
+  <define name="secondname.content">
+    <ref name="inlines"/>
+  </define>
   <define name="lastname.content">
     <ref name="inlines"/>
   </define>
+  <define name="label.content">
+    <ref name="inlines"/>
+  </define>
+  <!-- ~~~~~~ address -->
+  <define name="address">
+    <element name="address">
+      <ref name="address.content"/>
+    </element>
+  </define>
+  <define name="address.content">
+    <ref name="inlines"/>
+  </define>
   <!-- ~~~~~~ role -->
   <define name="role">
     <element name="role">
-      <ref name="role.attributes"/>
+      <ref name="role.content"/>
     </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 name="role.content">
+    <choice>
+      <value>author</value>
+      <value>illustrator</value>
+      <value>publisher</value>
+    </choice>
   </define>
   <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ place ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
   <define name="place">
@@ -714,10 +728,10 @@
   </define>
   <define name="item.content">
     <choice>
-      <ref name="inlines"/>
       <oneOrMore>
         <ref name="block"/>
       </oneOrMore>
+      <ref name="inlines"/>
     </choice>
   </define>
   <!-- ~~~~~~ glossary.item -->