RelaxNG/publiset.rng
changeset 20 79713ffae179
parent 5 69310bc35b63
child 21 7c09024d5634
--- a/RelaxNG/publiset.rng	dim. juin 12 14:28:07 2011 +0200
+++ b/RelaxNG/publiset.rng	dim. juin 12 15:21:35 2011 +0200
@@ -28,7 +28,7 @@
   </define>
   <!--
     =============================================================================
-                                     Top level
+                                     TOP LEVEL
     =============================================================================
   -->
   <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ composition ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
@@ -59,7 +59,7 @@
   </define>
   <define name="composition.content">
     <optional>
-      <ref name="composition.metadata"/>
+      <ref name="composition.head"/>
     </optional>
     <oneOrMore>
       <choice>
@@ -87,7 +87,7 @@
   </define>
   <define name="selection.content">
     <optional>
-      <ref name="selection.metadata"/>
+      <ref name="selection.head"/>
     </optional>
     <oneOrMore>
       <choice>
@@ -98,31 +98,39 @@
   </define>
   <!--
     =============================================================================
-                                    Metadata level
+                                     HEAD LEVEL
     =============================================================================
   -->
-  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ metadata ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
-  <define name="composition.metadata">
-    <element name="metadata">
-      <ref name="metadata.attributes"/>
-      <ref name="metadata.content"/>
+  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ head ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+  <define name="composition.head">
+    <element name="head">
+      <ref name="head.attributes"/>
+      <ref name="top.head.content"/>
     </element>
   </define>
-  <define name="selection.metadata">
-    <element name="metadata">
-      <ref name="metadata.content"/>
+  <define name="selection.head">
+    <element name="head">
+      <ref name="top.head.content"/>
     </element>
   </define>
-  <define name="metadata.attributes">
+  <define name="division.head">
+    <element name="head">
+      <ref name="division.head.content"/>
+    </element>
+  </define>
+  <define name="head.attributes">
     <ref name="remap.attributes"/>
   </define>
-  <define name="metadata.content">
+  <define name="top.head.content">
     <interleave>
       <optional>
         <ref name="title"/>
+        <optional>
+          <ref name="subtitle"/>
+        </optional>
       </optional>
       <optional>
-        <ref name="subtitle"/>
+        <ref name="language"/>
       </optional>
       <zeroOrMore>
         <ref name="author"/>
@@ -131,11 +139,24 @@
         <ref name="publisher"/>
       </optional>
       <optional>
+        <ref name="source"/>
+      </optional>
+    </interleave>
+  </define>
+  <define name="division.head.content">
+    <interleave>
+      <optional>
+        <ref name="title"/>
+        <optional>
+          <ref name="subtitle"/>
+        </optional>
+      </optional>
+      <optional>
         <ref name="language"/>
       </optional>
-      <optional>
-        <ref name="source"/>
-      </optional>
+      <zeroOrMore>
+        <ref name="annotation"/>
+      </zeroOrMore>
     </interleave>
   </define>
   <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ title, subtitle ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
@@ -144,14 +165,28 @@
       <ref name="title.content"/>
     </element>
   </define>
-  <define name="title.content">
-    <ref name="inlines"/>
-  </define>
   <define name="subtitle">
     <element name="subtitle">
       <ref name="title.content"/>
     </element>
   </define>
+  <define name="title.content">
+    <ref name="inlines"/>
+  </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>
   <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ author, publisher ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
   <!-- ~~~~~~ author -->
   <define name="author">
@@ -192,20 +227,6 @@
   <define name="lastname.content">
     <ref name="inlines"/>
   </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>
   <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ source ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
   <!-- ~~~~~~ source -->
   <define name="source">
@@ -264,7 +285,7 @@
   </define>
   <!--
     =============================================================================
-                                   Division level
+                                   DIVISION LEVEL
     =============================================================================
   -->
   <define name="composition.division">
@@ -294,29 +315,29 @@
   </define>
   <define name="composition.division.content">
     <optional>
-      <ref name="composition.metadata"/>
+      <ref name="composition.head"/>
     </optional>
     <oneOrMore>
       <choice>
+        <ref name="composition.division"/>
         <ref name="composition.file"/>
-        <ref name="composition.division"/>
       </choice>
     </oneOrMore>
   </define>
   <define name="selection.division.content">
     <optional>
-      <ref name="selection.metadata"/>
+      <ref name="selection.head"/>
     </optional>
     <oneOrMore>
       <choice>
+        <ref name="selection.division"/>
         <ref name="selection.file"/>
-        <ref name="selection.division"/>
       </choice>
     </oneOrMore>
   </define>
   <!--
     =============================================================================
-                                     File level
+                                     FILE LEVEL
     =============================================================================
   -->
   <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ file ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
@@ -337,23 +358,42 @@
       <optional>
         <ref name="xpath.attribute"/>
       </optional>
+      <optional>
+        <ref name="transform.attribute"/>
+      </optional>
       <ref name="remap.attributes"/>
     </interleave>
   </define>
   <define name="selection.file.attributes">
-    <optional>
-      <ref name="xpath.attribute"/>
-    </optional>
+    <interleave>
+      <optional>
+        <ref name="xpath.attribute"/>
+      </optional>
+      <optional>
+        <ref name="transform.attribute"/>
+      </optional>
+    </interleave>
   </define>
   <define name="xpath.attribute">
     <attribute name="xpath"/>
   </define>
+  <define name="transform.attribute">
+    <attribute name="transform">
+      <list>
+        <oneOrMore>
+          <data type="token">
+            <param name="pattern">(xsl|regex):\S+</param>
+          </data>
+        </oneOrMore>
+      </list>
+    </attribute>
+  </define>
   <define name="file.content">
     <data type="anyURI"/>
   </define>
   <!--
     =============================================================================
-                                    Inline level
+                                    INLINE LEVEL
     =============================================================================
   -->
   <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ inlines ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
@@ -382,7 +422,7 @@
   </define>
   <!--
     =============================================================================
-                                  Remap attributes
+                                  REMAP ATTRIBUTES
     =============================================================================
   -->
   <define name="remap.attributes">