Amélioration de la gestion des auteurs et des éditeurs
authorPatrick PIERRE <patrick.pierre@prismallia.fr>
lun., 18 juil. 2011 23:35:32 +0200
changeset 34 c51d5097d065
parent 33 c70de8fae29d
child 35 de4114d12ef1
Amélioration de la gestion des auteurs et des éditeurs
RelaxNG/publidoc.rnc
RelaxNG/publidoc.rng
RelaxNG/publiset.rnc
RelaxNG/publiset.rng
Xml/Documents/demi-douce.xml
Xml/Documents/torture_test.xml
Xml/Sets/composition.xml
--- a/RelaxNG/publidoc.rnc	lun. juil. 18 19:10:28 2011 +0200
+++ b/RelaxNG/publidoc.rnc	lun. juil. 18 23:35:32 2011 +0200
@@ -61,6 +61,7 @@
 
 top.head.content =
    (title, subtitle?)?
+ & identifier*
  & language?
  & author*
  & publisher?
@@ -93,11 +94,22 @@
 
 title.content = inlines
 
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ identifier ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+identifier = element identifier { identifier.content, identifier.attributes }
+
+identifier.attributes =
+   class.attribute
+class.attribute = attribute class { "uri" | "ean" }
+
+identifier.content =  xsd:anyURI | xsd:NMTOKEN
+
 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ language ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 language = element language { language.attributes }
 
-language.attributes = lang.attribute
+language.attributes =
+   lang.attribute
 lang.attribute = attribute xml:lang { xsd:language }
 
 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ author, publisher ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -114,16 +126,12 @@
    lastname,
    role*
 
-role = element role { role.attributes }
-
-role.attributes =
-   role.of.attribute
-role.of.attribute = attribute of { "author" | "illustrator" }
-
 # ~~~~~~ publisher
 publisher = element publisher { publisher.content }
 
-publisher.content = inlines
+publisher.content =
+   label,
+   url?
 
 # ~~~~~~ firstname
 firstname = element firstname { firstname.content }
@@ -135,6 +143,23 @@
 
 lastname.content = inlines
 
+# ~~~~~~ label
+label = element label { label.content }
+
+label.content = inlines
+
+# ~~~~~~ role
+role = element role { role.attributes }
+
+role.attributes =
+   role.of.attribute
+role.of.attribute = attribute of { "author" | "illustrator" }
+
+# ~~~~~~ url
+url = element url { url.content }
+
+url.content = xsd:anyURI
+
 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ place ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 place = element place { place.content }
@@ -302,11 +327,6 @@
    label,
    block+
 
-# ~~~~~~ label
-label = element label { label.content }
-
-label.content = inlines
-
 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ table ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 table = element table { table.content }
--- a/RelaxNG/publidoc.rng	lun. juil. 18 19:10:28 2011 +0200
+++ b/RelaxNG/publidoc.rng	lun. juil. 18 23:35:32 2011 +0200
@@ -129,6 +129,9 @@
           <ref name="subtitle"/>
         </optional>
       </optional>
+      <zeroOrMore>
+        <ref name="identifier"/>
+      </zeroOrMore>
       <optional>
         <ref name="language"/>
       </optional>
@@ -231,6 +234,30 @@
   <define name="title.content">
     <ref name="inlines"/>
   </define>
+  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ identifier ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+  <define name="identifier">
+    <element name="identifier">
+      <ref name="identifier.content"/>
+      <ref name="identifier.attributes"/>
+    </element>
+  </define>
+  <define name="identifier.attributes">
+    <ref name="class.attribute"/>
+  </define>
+  <define name="class.attribute">
+    <attribute name="class">
+      <choice>
+        <value>uri</value>
+        <value>ean</value>
+      </choice>
+    </attribute>
+  </define>
+  <define name="identifier.content">
+    <choice>
+      <data type="anyURI"/>
+      <data type="NMTOKEN"/>
+    </choice>
+  </define>
   <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ language ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
   <define name="language">
     <element name="language">
@@ -274,22 +301,6 @@
       <ref name="role"/>
     </zeroOrMore>
   </define>
-  <define name="role">
-    <element name="role">
-      <ref name="role.attributes"/>
-    </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>
   <!-- ~~~~~~ publisher -->
   <define name="publisher">
     <element name="publisher">
@@ -297,7 +308,10 @@
     </element>
   </define>
   <define name="publisher.content">
-    <ref name="inlines"/>
+    <ref name="label"/>
+    <optional>
+      <ref name="url"/>
+    </optional>
   </define>
   <!-- ~~~~~~ firstname -->
   <define name="firstname">
@@ -317,6 +331,41 @@
   <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">
+      <ref name="role.attributes"/>
+    </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>
+  <!-- ~~~~~~ url -->
+  <define name="url">
+    <element name="url">
+      <ref name="url.content"/>
+    </element>
+  </define>
+  <define name="url.content">
+    <data type="anyURI"/>
+  </define>
   <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ place ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
   <define name="place">
     <element name="place">
@@ -632,15 +681,6 @@
       <ref name="block"/>
     </oneOrMore>
   </define>
-  <!-- ~~~~~~ label -->
-  <define name="label">
-    <element name="label">
-      <ref name="label.content"/>
-    </element>
-  </define>
-  <define name="label.content">
-    <ref name="inlines"/>
-  </define>
   <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ table ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
   <define name="table">
     <element name="table">
--- a/RelaxNG/publiset.rnc	lun. juil. 18 19:10:28 2011 +0200
+++ b/RelaxNG/publiset.rnc	lun. juil. 18 23:35:32 2011 +0200
@@ -74,6 +74,7 @@
 
 top.head.content =
    (title, subtitle?)?
+ & identifier*
  & language?
  & author*
  & publisher?
@@ -89,6 +90,16 @@
 
 title.content = inlines
 
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ identifier ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+identifier = element identifier { identifier.content, identifier.attributes }
+
+identifier.attributes =
+   class.attribute
+class.attribute = attribute class { "uri" | "ean" }
+
+identifier.content =  xsd:anyURI | xsd:NMTOKEN
+
 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ language ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 language = element language { language.attributes }
@@ -101,14 +112,21 @@
 # ~~~~~~ author
 author = element author { author.content }
 
+author.attributes =
+   role.attribute?
+role.attribute = attribute role { "author" | "illustrator" }
+
 author.content =
    firstname?,
-   lastname
+   lastname,
+   role*
 
 # ~~~~~~ publisher
 publisher = element publisher { publisher.content }
 
-publisher.content = inlines
+publisher.content =
+   label,
+   url?
 
 # ~~~~~~ firstname
 firstname = element firstname { firstname.content }
@@ -120,6 +138,23 @@
 
 lastname.content = inlines
 
+# ~~~~~~ label
+label = element label { label.content }
+
+label.content = inlines
+
+# ~~~~~~ role
+role = element role { role.attributes }
+
+role.attributes =
+   role.of.attribute
+role.of.attribute = attribute of { "author" | "illustrator" }
+
+# ~~~~~~ url
+url = element url { url.content }
+
+url.content = xsd:anyURI
+
 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ source ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 # ~~~~~~ source
--- a/RelaxNG/publiset.rng	lun. juil. 18 19:10:28 2011 +0200
+++ b/RelaxNG/publiset.rng	lun. juil. 18 23:35:32 2011 +0200
@@ -147,6 +147,9 @@
           <ref name="subtitle"/>
         </optional>
       </optional>
+      <zeroOrMore>
+        <ref name="identifier"/>
+      </zeroOrMore>
       <optional>
         <ref name="language"/>
       </optional>
@@ -188,6 +191,30 @@
   <define name="title.content">
     <ref name="inlines"/>
   </define>
+  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ identifier ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+  <define name="identifier">
+    <element name="identifier">
+      <ref name="identifier.content"/>
+      <ref name="identifier.attributes"/>
+    </element>
+  </define>
+  <define name="identifier.attributes">
+    <ref name="class.attribute"/>
+  </define>
+  <define name="class.attribute">
+    <attribute name="class">
+      <choice>
+        <value>uri</value>
+        <value>ean</value>
+      </choice>
+    </attribute>
+  </define>
+  <define name="identifier.content">
+    <choice>
+      <data type="anyURI"/>
+      <data type="NMTOKEN"/>
+    </choice>
+  </define>
   <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ language ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
   <define name="language">
     <element name="language">
@@ -209,11 +236,27 @@
       <ref name="author.content"/>
     </element>
   </define>
+  <define name="author.attributes">
+    <optional>
+      <ref name="role.attribute"/>
+    </optional>
+  </define>
+  <define name="role.attribute">
+    <attribute name="role">
+      <choice>
+        <value>author</value>
+        <value>illustrator</value>
+      </choice>
+    </attribute>
+  </define>
   <define name="author.content">
     <optional>
       <ref name="firstname"/>
     </optional>
     <ref name="lastname"/>
+    <zeroOrMore>
+      <ref name="role"/>
+    </zeroOrMore>
   </define>
   <!-- ~~~~~~ publisher -->
   <define name="publisher">
@@ -222,7 +265,10 @@
     </element>
   </define>
   <define name="publisher.content">
-    <ref name="inlines"/>
+    <ref name="label"/>
+    <optional>
+      <ref name="url"/>
+    </optional>
   </define>
   <!-- ~~~~~~ firstname -->
   <define name="firstname">
@@ -242,6 +288,41 @@
   <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">
+      <ref name="role.attributes"/>
+    </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>
+  <!-- ~~~~~~ url -->
+  <define name="url">
+    <element name="url">
+      <ref name="url.content"/>
+    </element>
+  </define>
+  <define name="url.content">
+    <data type="anyURI"/>
+  </define>
   <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ source ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
   <!-- ~~~~~~ source -->
   <define name="source">
--- a/Xml/Documents/demi-douce.xml	lun. juil. 18 19:10:28 2011 +0200
+++ b/Xml/Documents/demi-douce.xml	lun. juil. 18 23:35:32 2011 +0200
@@ -9,7 +9,7 @@
       <author>
         <firstname>Henri</firstname><lastname>Ostrowiecki</lastname>
       </author>
-      <publisher>Les éditions des Rosiers</publisher>
+      <publisher><label>Les éditions des Rosiers</label></publisher>
       <abstract>
         <p>
           C'est l'histoire d'un petit garçon qui faillit ne jamais avoir 5 ans
--- a/Xml/Documents/torture_test.xml	lun. juil. 18 19:10:28 2011 +0200
+++ b/Xml/Documents/torture_test.xml	lun. juil. 18 23:35:32 2011 +0200
@@ -5,6 +5,9 @@
     <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>
+      <language xml:lang="fr"/>
       <author>
         <firstname>Patrick</firstname><lastname>PIERRE</lastname>
       </author>
@@ -12,8 +15,10 @@
         <firstname>Tien Haï</firstname><lastname>NGUYEN</lastname>
         <role of="illustrator"/>
       </author>
-      <publisher>Prismallia</publisher>
-      <language xml:lang="fr"/>
+      <publisher>
+        <label>Prismallia</label>
+        <url>http://www.prismallia.fr</url>
+      </publisher>
       <date value="2001-06"/>
       <place>Paris</place>
       <source type="book" id="9782843550362">
--- a/Xml/Sets/composition.xml	lun. juil. 18 19:10:28 2011 +0200
+++ b/Xml/Sets/composition.xml	lun. juil. 18 23:35:32 2011 +0200
@@ -5,7 +5,15 @@
     <division as="document" attributes="xml:id=composition">
       <head>
         <title>Exemple d'assemblage de sujets</title>
+        <identifier class="ean">978-2-35184-011-4</identifier>
         <language xml:lang="fr"/>
+        <author>
+          <firstname>Patrick</firstname><lastname>PIERRE</lastname>
+        </author>
+        <publisher>
+          <label>Prismallia</label>
+          <url>http://www.prismallia.fr</url>
+        </publisher>
       </head>
 
       <!-- ========================== Événements ========================== -->