Amélioration de la balise <identifier>
authorPatrick PIERRE <patrick.pierre@prismallia.fr>
mer., 20 juil. 2011 14:38:48 +0200
changeset 38 3c8b406be906
parent 37 83b7ec3c3132
child 39 7faa356bad3e
Amélioration de la balise <identifier>
RelaxNG/publidoc.rnc
RelaxNG/publidoc.rng
RelaxNG/publiset.rnc
RelaxNG/publiset.rng
Xml/Documents/torture_test.xml
Xml/Sets/composition.xml
Xml/Topics/centre_pompidou.xml
Xml/Topics/chasseurs.xml
Xml/Topics/portugal_ue.xml
Xml/Topics/prince_belge.xml
--- a/RelaxNG/publidoc.rnc	mar. juil. 19 18:16:50 2011 +0200
+++ b/RelaxNG/publidoc.rnc	mer. juil. 20 14:38:48 2011 +0200
@@ -97,13 +97,15 @@
 
 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ identifier ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-identifier = element identifier { identifier.content, identifier.attributes }
+identifier.uri = element identifier {
+   attribute type { "uri" }, xsd:anyURI
+}
 
-identifier.attributes =
-   class.attribute
-class.attribute = attribute class { "uri" | "ean" }
+identifier.ean = element identifier {
+   attribute type { "ean" }, xsd:token {pattern = "\d{13}"}
+}
 
-identifier.content =  xsd:anyURI | xsd:NMTOKEN
+identifier = identifier.uri | identifier.ean
 
 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ language ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
@@ -144,11 +146,6 @@
 
 lastname.content = inlines
 
-# ~~~~~~ label
-label = element label { label.content }
-
-label.content = inlines
-
 # ~~~~~~ role
 role = element role { role.attributes }
 
@@ -156,6 +153,11 @@
    role.of.attribute
 role.of.attribute = attribute of { "author" | "illustrator" }
 
+# ~~~~~~ label
+label = element label { label.content }
+
+label.content = inlines
+
 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ place ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 place = element place { place.content }
@@ -166,19 +168,17 @@
 
 # ~~~~~~ source
 source = element source {
-   source.attributes,
    (  (attribute type { "book" }, source.content.book)
-    | (attribute type { "file" })),
+    | (attribute type { "file" }, source.content.file)),
    source.content
 }
 
-source.attributes =
-   source.id.attribute
-source.id.attribute = attribute id { xsd:NMTOKEN }
-
 source.content.book =
-   title,
+   identifier.ean,
+   title?,
    pagenumber*
+source.content.file =
+   identifier.uri
 source.content =
    annotation*
 
--- 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"/>
--- a/RelaxNG/publiset.rnc	mar. juil. 19 18:16:50 2011 +0200
+++ b/RelaxNG/publiset.rnc	mer. juil. 20 14:38:48 2011 +0200
@@ -93,13 +93,15 @@
 
 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ identifier ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-identifier = element identifier { identifier.content, identifier.attributes }
+identifier.uri = element identifier {
+   attribute type { "uri" }, xsd:anyURI
+}
 
-identifier.attributes =
-   class.attribute
-class.attribute = attribute class { "uri" | "ean" }
+identifier.ean = element identifier {
+   attribute type { "ean" }, xsd:token {pattern = "\d{13}"}
+}
 
-identifier.content =  xsd:anyURI | xsd:NMTOKEN
+identifier = identifier.uri | identifier.ean
 
 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ language ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
@@ -139,11 +141,6 @@
 
 lastname.content = inlines
 
-# ~~~~~~ label
-label = element label { label.content }
-
-label.content = inlines
-
 # ~~~~~~ role
 role = element role { role.attributes }
 
@@ -151,23 +148,25 @@
    role.of.attribute
 role.of.attribute = attribute of { "author" | "illustrator" }
 
+# ~~~~~~ label
+label = element label { label.content }
+
+label.content = inlines
+
 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ source ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 # ~~~~~~ source
 source = element source {
-   source.attributes,
    (  (attribute type { "book" }, source.content.book)
-    | (attribute type { "file" }))
+    | (attribute type { "file" }, source.content.file))
 }
 
-source.attributes =
-   source.id.attribute?
- & remap.attributes
-source.id.attribute = attribute id { xsd:NMTOKEN }
-
 source.content.book =
+   identifier.ean,
    title?,
-   pagenumber?
+   pagenumber*
+source.content.file =
+   identifier.uri
 
 # ~~~~~~ pagenumber
 pagenumber = element pagenumber { pagenumber.attributes }
--- a/RelaxNG/publiset.rng	mar. juil. 19 18:16:50 2011 +0200
+++ b/RelaxNG/publiset.rng	mer. juil. 20 14:38:48 2011 +0200
@@ -195,27 +195,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 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
@@ -291,15 +292,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">
@@ -317,11 +309,19 @@
       </choice>
     </attribute>
   </define>
+  <!-- ~~~~~~ label -->
+  <define name="label">
+    <element name="label">
+      <ref name="label.content"/>
+    </element>
+  </define>
+  <define name="label.content">
+    <ref name="inlines"/>
+  </define>
   <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ source ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
   <!-- ~~~~~~ source -->
   <define name="source">
     <element name="source">
-      <ref name="source.attributes"/>
       <choice>
         <group>
           <attribute name="type">
@@ -329,32 +329,26 @@
           </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>
     </element>
   </define>
-  <define name="source.attributes">
-    <interleave>
-      <optional>
-        <ref name="source.id.attribute"/>
-      </optional>
-      <ref name="remap.attributes"/>
-    </interleave>
-  </define>
-  <define name="source.id.attribute">
-    <attribute name="id">
-      <data type="NMTOKEN"/>
-    </attribute>
-  </define>
   <define name="source.content.book">
+    <ref name="identifier.ean"/>
     <optional>
       <ref name="title"/>
     </optional>
-    <optional>
+    <zeroOrMore>
       <ref name="pagenumber"/>
-    </optional>
+    </zeroOrMore>
+  </define>
+  <define name="source.content.file">
+    <ref name="identifier.uri"/>
   </define>
   <!-- ~~~~~~ pagenumber -->
   <define name="pagenumber">
--- a/Xml/Documents/torture_test.xml	mar. juil. 19 18:16:50 2011 +0200
+++ b/Xml/Documents/torture_test.xml	mer. juil. 20 14:38:48 2011 +0200
@@ -5,8 +5,8 @@
     <head>
       <title>Torture test</title>
       <subtitle>Test des capacités de <name>publidoc</name></subtitle>
-      <identifier class="ean">978-2-35184-011-4</identifier>
-      <identifier class="uri">http://www.prismallia.fr/Xml/torture_test</identifier>
+      <identifier type="ean">9782351840114</identifier>
+      <identifier type="uri">http://www.prismallia.fr/Xml/torture_test</identifier>
       <language xml:lang="fr"/>
       <author>
         <firstname>Patrick</firstname><lastname>PIERRE</lastname>
@@ -21,11 +21,14 @@
       </publisher>
       <date value="2001-06"/>
       <place>Paris</place>
-      <source type="book" id="9782843550362">
+      <source type="book">
+        <identifier type="ean">9782843550362</identifier>
         <title>Les Misérables</title>
         <pagenumber value="312"/>
       </source>
-      <source type="file" id="hugo_miserables.xml"/>
+      <source type="file">
+        <identifier type="uri">hugo_miserables.xml</identifier>
+      </source>
       <subjectset>
         <subject id="test"/>
         <subject id="littérature"/>
--- a/Xml/Sets/composition.xml	mar. juil. 19 18:16:50 2011 +0200
+++ b/Xml/Sets/composition.xml	mer. juil. 20 14:38:48 2011 +0200
@@ -5,7 +5,7 @@
     <division as="document" attributes="xml:id=composition">
       <head>
         <title>Exemple d'assemblage de sujets</title>
-        <identifier class="ean">978-2-35184-011-4</identifier>
+        <identifier type="ean">9782351840114</identifier>
         <language xml:lang="fr"/>
         <author>
           <firstname>Patrick</firstname><lastname>PIERRE</lastname>
--- a/Xml/Topics/centre_pompidou.xml	mar. juil. 19 18:16:50 2011 +0200
+++ b/Xml/Topics/centre_pompidou.xml	mer. juil. 20 14:38:48 2011 +0200
@@ -8,11 +8,14 @@
       <language xml:lang="fr-FR"/>
       <date value="2000-01-01"/>
       <place>Paris</place>
-      <source type="book" id="9782843550362">
+      <source type="book">
+        <identifier type="ean">9782843550362</identifier>
         <title>Chronique de l'année 2000</title>
         <pagenumber value="4"/>
       </source>
-      <source type="file" id="4a.tex"/>
+      <source type="file">
+        <identifier type="uri">4a.tex</identifier>
+      </source>
       <subjectset>
         <subject id="France"/>
         <subject id="Architecture"/>
--- a/Xml/Topics/chasseurs.xml	mar. juil. 19 18:16:50 2011 +0200
+++ b/Xml/Topics/chasseurs.xml	mer. juil. 20 14:38:48 2011 +0200
@@ -8,11 +8,14 @@
       <language xml:lang="fr-FR"/>
       <date value="2000-02-01"/>
       <place>Baie de Somme</place>
-      <source type="book" id="978-2-8435-5036-2">
+      <source type="book">
+        <identifier type="ean">9782843550362</identifier>
         <title>Chronique de l'année 2000</title>
         <pagenumber value="12"/>
       </source>
-      <source type="file" id="12a.tex"/>
+      <source type="file">
+        <identifier type="uri">12a.tex</identifier>
+      </source>
     </head>
 
     <section>
--- a/Xml/Topics/portugal_ue.xml	mar. juil. 19 18:16:50 2011 +0200
+++ b/Xml/Topics/portugal_ue.xml	mer. juil. 20 14:38:48 2011 +0200
@@ -8,11 +8,14 @@
       <language xml:lang="fr-FR"/>
       <date value="2000-01-01"/>
       <place>Lisbonne</place>
-      <source type="book" id="978-2-8435-5036-2">
+      <source type="book">
+        <identifier type="ean">9782843550362</identifier>
         <title>Chronique de l'année 2000</title>
         <pagenumber value="4"/>
       </source>
-      <source type="file" id="4z.tex"/>
+      <source type="file">
+        <identifier type="uri">4z.tex</identifier>
+      </source>
     </head>
 
     <section>
--- a/Xml/Topics/prince_belge.xml	mar. juil. 19 18:16:50 2011 +0200
+++ b/Xml/Topics/prince_belge.xml	mer. juil. 20 14:38:48 2011 +0200
@@ -6,11 +6,14 @@
       <title>Janvier 2000</title>
       <language xml:lang="fr-FR"/>
       <date value="2000-01"/>
-      <source type="book" id="9782843550362">
+      <source type="book">
+        <identifier type="ean">9782843550362</identifier>
         <title>Chronique de l'année 2000</title>
         <pagenumber value="8"/>
       </source>
-      <source type="file" id="e8.tex"/>
+      <source type="file">
+        <identifier type="uri">e8.tex</identifier>
+      </source>
     </head>
 
     <section>