Exemple de sélection
authorPatrick PIERRE <patrick.pierre@prismallia.fr>
sam., 18 juin 2011 09:47:23 +0200
changeset 29 0bd36d3b6a5a
parent 28 29c17c272cea
child 30 c0f9e813c039
Exemple de sélection
RelaxNG/publiset.rnc
RelaxNG/publiset.rng
Xml/Sets/composition.xml
Xml/Sets/selection.xml
--- a/RelaxNG/publiset.rnc	sam. juin 18 09:09:04 2011 +0200
+++ b/RelaxNG/publiset.rnc	sam. juin 18 09:47:23 2011 +0200
@@ -29,8 +29,14 @@
 
 composition.attributes =
    composition.id.attribute
+ & path.attribute?
+ & xpath.attribute?
+ & xslt.attribute?
  & remap.attributes
 composition.id.attribute = attribute xml:id { xsd:ID }
+path.attribute = attribute path { xsd:anyURI }
+xslt.attribute = attribute xslt { xsd:anyURI }
+xpath.attribute = attribute xpath { text }
 
 composition.content =
    composition.head?,
@@ -44,7 +50,9 @@
 }
 
 selection.attributes =
-   path.attribute?
+   selection.id.attribute
+ & path.attribute?
+ & xpath.attribute?
 selection.id.attribute = attribute xml:id { xsd:ID }
 
 selection.content =
@@ -155,14 +163,12 @@
 
 composition.division.attributes =
    path.attribute?
+ & xpath.attribute?
  & xslt.attribute?
- & xpath.attribute?
  & remap.attributes
 selection.division.attributes =
    path.attribute?
-path.attribute = attribute path { xsd:anyURI }
-xslt.attribute = attribute xslt { xsd:anyURI }
-xpath.attribute = attribute xpath { text }
+ & xpath.attribute?
 
 composition.division.content =
    composition.head?,
@@ -182,12 +188,11 @@
 selection.file = element file { selection.file.attributes, file.content }
 
 composition.file.attributes =
-   xslt.attribute?
- & xpath.attribute?
+   xpath.attribute?
+ & xslt.attribute?
  & remap.attributes
 selection.file.attributes =
    xpath.attribute?
- & xslt.attribute?
 
 file.content = xsd:anyURI
    
--- a/RelaxNG/publiset.rng	sam. juin 18 09:09:04 2011 +0200
+++ b/RelaxNG/publiset.rng	sam. juin 18 09:47:23 2011 +0200
@@ -41,6 +41,15 @@
   <define name="composition.attributes">
     <interleave>
       <ref name="composition.id.attribute"/>
+      <optional>
+        <ref name="path.attribute"/>
+      </optional>
+      <optional>
+        <ref name="xpath.attribute"/>
+      </optional>
+      <optional>
+        <ref name="xslt.attribute"/>
+      </optional>
       <ref name="remap.attributes"/>
     </interleave>
   </define>
@@ -49,6 +58,19 @@
       <data type="ID"/>
     </attribute>
   </define>
+  <define name="path.attribute">
+    <attribute name="path">
+      <data type="anyURI"/>
+    </attribute>
+  </define>
+  <define name="xslt.attribute">
+    <attribute name="xslt">
+      <data type="anyURI"/>
+    </attribute>
+  </define>
+  <define name="xpath.attribute">
+    <attribute name="xpath"/>
+  </define>
   <define name="composition.content">
     <optional>
       <ref name="composition.head"/>
@@ -68,9 +90,15 @@
     </element>
   </define>
   <define name="selection.attributes">
-    <optional>
-      <ref name="path.attribute"/>
-    </optional>
+    <interleave>
+      <ref name="selection.id.attribute"/>
+      <optional>
+        <ref name="path.attribute"/>
+      </optional>
+      <optional>
+        <ref name="xpath.attribute"/>
+      </optional>
+    </interleave>
   </define>
   <define name="selection.id.attribute">
     <attribute name="xml:id">
@@ -295,31 +323,23 @@
         <ref name="path.attribute"/>
       </optional>
       <optional>
-        <ref name="xslt.attribute"/>
+        <ref name="xpath.attribute"/>
       </optional>
       <optional>
-        <ref name="xpath.attribute"/>
+        <ref name="xslt.attribute"/>
       </optional>
       <ref name="remap.attributes"/>
     </interleave>
   </define>
   <define name="selection.division.attributes">
-    <optional>
-      <ref name="path.attribute"/>
-    </optional>
-  </define>
-  <define name="path.attribute">
-    <attribute name="path">
-      <data type="anyURI"/>
-    </attribute>
-  </define>
-  <define name="xslt.attribute">
-    <attribute name="xslt">
-      <data type="anyURI"/>
-    </attribute>
-  </define>
-  <define name="xpath.attribute">
-    <attribute name="xpath"/>
+    <interleave>
+      <optional>
+        <ref name="path.attribute"/>
+      </optional>
+      <optional>
+        <ref name="xpath.attribute"/>
+      </optional>
+    </interleave>
   </define>
   <define name="composition.division.content">
     <optional>
@@ -364,23 +384,18 @@
   <define name="composition.file.attributes">
     <interleave>
       <optional>
-        <ref name="xslt.attribute"/>
+        <ref name="xpath.attribute"/>
       </optional>
       <optional>
-        <ref name="xpath.attribute"/>
+        <ref name="xslt.attribute"/>
       </optional>
       <ref name="remap.attributes"/>
     </interleave>
   </define>
   <define name="selection.file.attributes">
-    <interleave>
-      <optional>
-        <ref name="xpath.attribute"/>
-      </optional>
-      <optional>
-        <ref name="xslt.attribute"/>
-      </optional>
-    </interleave>
+    <optional>
+      <ref name="xpath.attribute"/>
+    </optional>
   </define>
   <define name="file.content">
     <data type="anyURI"/>
--- a/Xml/Sets/composition.xml	sam. juin 18 09:09:04 2011 +0200
+++ b/Xml/Sets/composition.xml	sam. juin 18 09:47:23 2011 +0200
@@ -1,6 +1,6 @@
 <?xml version='1.0' encoding='utf-8'?>
+<!-- $Id$ -->
 <publiset version="1.0">
-  <!-- $Id$ -->
   <composition xml:id="composition" as="publidoc" attributes="version=1.0">
     <division as="document" attributes="xml:id=composition">
       <head>
--- /dev/null	jeu. janv. 01 00:00:00 1970 +0000
+++ b/Xml/Sets/selection.xml	sam. juin 18 09:47:23 2011 +0200
@@ -0,0 +1,39 @@
+<?xml version='1.0' encoding='utf-8'?>
+<!-- $Id$ -->
+<publiset version="1.0">
+  <selection xml:id="selection">
+    <division>
+      <head>
+        <title>Exemple de sélection de sujets</title>
+        <language xml:lang="fr"/>
+      </head>
+
+      <!-- ========================== Événements ========================== -->
+      <division path="../Topics">
+        <head>
+          <title>Les événements</title>
+        </head>
+        <file>centre_pompidou.xml</file>
+        <file>chasseurs.xml</file>
+      </division>
+
+      <!-- =========================== Brèves ============================= -->
+      <division>
+        <head>
+          <title>Les brèves</title>
+        </head>
+        <file>../Topics/portugal_ue.xml</file>
+      </division>
+      
+      <!-- =========================== Photos ============================= -->
+      <division path="../Topics">
+        <head>
+          <title>Les photos avec légende</title>
+        </head>
+        <division>
+          <file xpath="topic/section">roi_belge.xml</file>
+        </division>
+      </division>
+    </division>
+  </selection>
+</publiset>