RelaxNG/publidoc.rng
changeset 38 3c8b406be906
parent 37 83b7ec3c3132
child 39 7faa356bad3e
--- a/RelaxNG/publidoc.rng	mar. juil. 19 18:16:50 2011 +0200
+++ b/RelaxNG/publidoc.rng	mer. juil. 20 14:38:48 2011 +0200
@@ -238,27 +238,28 @@
     <ref name="inlines"/>
   </define>
   <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ identifier ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
-  <define name="identifier">
+  <define name="identifier.uri">
     <element name="identifier">
-      <ref name="identifier.content"/>
-      <ref name="identifier.attributes"/>
+      <attribute name="type">
+        <value>uri</value>
+      </attribute>
+      <data type="anyURI"/>
     </element>
   </define>
-  <define name="identifier.attributes">
-    <ref name="class.attribute"/>
+  <define name="identifier.ean">
+    <element name="identifier">
+      <attribute name="type">
+        <value>ean</value>
+      </attribute>
+      <data type="token">
+        <param name="pattern">\d{13}</param>
+      </data>
+    </element>
   </define>
-  <define name="class.attribute">
-    <attribute name="class">
-      <choice>
-        <value>uri</value>
-        <value>ean</value>
-      </choice>
-    </attribute>
-  </define>
-  <define name="identifier.content">
+  <define name="identifier">
     <choice>
-      <data type="anyURI"/>
-      <data type="NMTOKEN"/>
+      <ref name="identifier.uri"/>
+      <ref name="identifier.ean"/>
     </choice>
   </define>
   <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ language ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
@@ -334,15 +335,6 @@
   <define name="lastname.content">
     <ref name="inlines"/>
   </define>
-  <!-- ~~~~~~ label -->
-  <define name="label">
-    <element name="label">
-      <ref name="label.content"/>
-    </element>
-  </define>
-  <define name="label.content">
-    <ref name="inlines"/>
-  </define>
   <!-- ~~~~~~ role -->
   <define name="role">
     <element name="role">
@@ -360,6 +352,15 @@
       </choice>
     </attribute>
   </define>
+  <!-- ~~~~~~ label -->
+  <define name="label">
+    <element name="label">
+      <ref name="label.content"/>
+    </element>
+  </define>
+  <define name="label.content">
+    <ref name="inlines"/>
+  </define>
   <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ place ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
   <define name="place">
     <element name="place">
@@ -373,7 +374,6 @@
   <!-- ~~~~~~ source -->
   <define name="source">
     <element name="source">
-      <ref name="source.attributes"/>
       <choice>
         <group>
           <attribute name="type">
@@ -381,27 +381,28 @@
           </attribute>
           <ref name="source.content.book"/>
         </group>
-        <attribute name="type">
-          <value>file</value>
-        </attribute>
+        <group>
+          <attribute name="type">
+            <value>file</value>
+          </attribute>
+          <ref name="source.content.file"/>
+        </group>
       </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"/>
+    <ref name="identifier.ean"/>
+    <optional>
+      <ref name="title"/>
+    </optional>
     <zeroOrMore>
       <ref name="pagenumber"/>
     </zeroOrMore>
   </define>
+  <define name="source.content.file">
+    <ref name="identifier.uri"/>
+  </define>
   <define name="source.content">
     <zeroOrMore>
       <ref name="annotation"/>