Réorganisation
authorPatrick PIERRE
jeu., 24 avril 2014 20:36:03 +0200
changeset 310 13939fb7824a
parent 309 b748affd5db2
child 311 edaace4c8f05
Réorganisation
RelaxNG/publidoc.rnc
RelaxNG/publiquiz.rnc
RelaxNG/publiset.rnc
--- a/RelaxNG/publidoc.rnc	mer. avril 16 13:07:05 2014 +0200
+++ b/RelaxNG/publidoc.rnc	jeu. avril 24 20:36:03 2014 +0200
@@ -18,6 +18,172 @@
 
 
 # =============================================================================
+#                                 HEAD LEVEL
+# =============================================================================
+
+# ~~~~~~~~~~~~~~~~~~~~~~~ title, shorttitle, subtitle ~~~~~~~~~~~~~~~~~~~~~~~~~
+
+title = element title { title.content }
+shorttitle = element shorttitle { title.content }
+subtitle = element subtitle { title.content }
+
+title.content = inlines
+
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ identifier ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+# ~~~~~~ identifier
+identifier = element identifier {
+   (attribute type { "ean" }, for.attribute?, xsd:token {pattern = "\d{13}"})
+ | (attribute type { "uri" }, for.attribute?, xsd:anyURI)
+}
+
+# ~~~~~~ identifier.ean
+identifier.ean = element identifier {
+   attribute type { "ean" }, for.attribute?, xsd:token {pattern = "\d{13}"}
+}
+
+# ~~~~~~ identifier.uri
+identifier.uri = element identifier {
+   attribute type { "uri" }, for.attribute?, xsd:anyURI
+}
+
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ copyright ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+copyright = element copyright { copyright.content }
+
+copyright.content = simple.inlines
+
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ collection ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+collection = element collection { collection.content }
+
+collection.content = simple.inlines
+
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ contributors ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+# ~~~~~~ contributors
+contributors = element contributors { contributors.content }
+
+contributors.content =
+   contributor+
+
+# ~~~~~~ contributor
+contributor = element contributor { contributor.content }
+
+contributor.content =
+   identifier.uri?,
+   (((firstname, secondname?)?, lastname) | label),
+   address?,
+   link?,
+   role+
+
+# ~~~~~~ firstname, secondname, lastname, label
+firstname = element firstname { firstname.content }
+secondname = element secondname { secondname.content }
+lastname = element lastname { lastname.content }
+label = element label { label.content }
+
+firstname.content = simple.inlines
+secondname.content = simple.inlines
+lastname.content = simple.inlines
+label.content = simple.inlines
+
+# ~~~~~~ address
+address = element address { address.content }
+
+address.content = simple.inlines
+
+# ~~~~~~ role
+role = element role { role.content }
+
+role.content = "author" | "illustrator" | "publisher" | "packager"
+
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ place ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+place = element place { place.content }
+
+place.content = simple.inlines
+
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ source ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+source = element source {
+   (  (attribute type { "book" }, bibliography.entry.content)
+    | (attribute type { "file" }, source.content.file)),
+   source.content
+}
+
+source.content.file =
+   identifier.uri
+source.content =
+   annotation*
+
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ keyword & subject ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+# ~~~~~~ keywordset
+keywordset = element keywordset { keywordset.content }
+
+keywordset.content = keyword+
+
+# ~~~~~~ keyword
+keyword = element keyword { keyword.content }
+
+keyword.content = simple.inlines
+
+# ~~~~~~ subjectset
+subjectset = element subjectset { subjectset.content }
+
+subjectset.content = subject+
+
+# ~~~~~~ subject
+subject = element subject { subject.content }
+
+subject.content = simple.inlines
+
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ index ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+# ~~~~~~ index
+index = element index { index.content }
+head.index = element index { head.index.content }
+
+index.content =
+   (index.w, index.entry?)
+ | (index.entry, (index.w | index.entry)?)
+head.index.content =
+   index.entry, index.entry?
+
+# ~~~~~~ index.w
+index.w = element w { simple.inlines }
+
+# ~~~~~~ index.entry
+index.entry = element entry { simple.inlines }
+
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ abstract ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+abstract = element abstract { abstract.content }
+
+abstract.content =
+   p+
+
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cover ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+cover = element cover { cover.content }
+
+cover.content =
+   cover.image
+
+cover.image = element image { cover.image.attributes }
+
+cover.image.attributes =
+   media.id.attribute
+
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ annotation ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+annotation = element annotation { annotation.content }
+
+annotation.content = inlines
+
+
+# =============================================================================
 #                                  TOP LEVEL
 # =============================================================================
 
@@ -43,7 +209,6 @@
 
 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ document ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-# ~~~~~~ document
 document = element document { document.attributes, document.content }
 
 document.attributes =
@@ -58,7 +223,7 @@
    top.head?,
    (division | topic)+
 
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ topic ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ top.topic ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 top.topic = element topic { top.topic.attributes, top.topic.content }
 
@@ -80,9 +245,18 @@
 #                                 DIVISION LEVEL
 # =============================================================================
 
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ division.head ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+division.head = element head { division.head.content }
+
+division.head.content =
+   (title, shorttitle?, subtitle*)?
+ & head.index*
+ & abstract?
+ & annotation*
+
 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ division ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-# ~~~~~~ division
 division = element division { division.attributes, division.content }
 
 division.attributes =
@@ -94,16 +268,8 @@
    front?,
    (division | topic)+
 
-# ~~~~~~ division.head
-division.head = element head { division.head.content }
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ front ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-division.head.content =
-   (title, shorttitle?, subtitle*)?
- & head.index*
- & abstract?
- & annotation*
-
-# ~~~~~~ front
 front = element front { front.content }
 
 front.content =
@@ -150,6 +316,19 @@
 #                                 SECTION LEVEL
 # =============================================================================
 
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ section.head ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+section.head = element head { section.head.content }
+
+section.head.content =
+   (title, shorttitle?, subtitle*)?
+ & keywordset?
+ & subjectset?
+ & head.index*
+ & abstract?
+ & audio*
+ & annotation*
+
 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ header ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 header = element header { header.content }
@@ -159,7 +338,6 @@
 
 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ section ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-# ~~~~~~ section
 section = element section { section.attributes, section.content }
 
 section.attributes =
@@ -174,21 +352,8 @@
    section.head?,
    (section+ | block+)
 
-# ~~~~~~ section.head
-section.head = element head { section.head.content }
-
-section.head.content =
-   (title, shorttitle?, subtitle*)?
- & keywordset?
- & subjectset?
- & head.index*
- & abstract?
- & audio*
- & annotation*
-
 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ bibliography ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-# ~~~~~~ bibliography
 bibliography = element bibliography { bibliography.content }
 
 bibliography.content =
@@ -206,18 +371,18 @@
 #                                 BLOCK LEVEL
 # =============================================================================
 
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ block ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ block.head ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-# ~~~~~~ block
-block = (p | speech | \list | blockquote | table | table.cals | media)
-
-# ~~~~~~ block.head
 block.head = element head { block.head.content }
 
 block.head.content =
    (title, shorttitle?, subtitle*)?
  & head.index*
 
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ block ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+block = (p | speech | \list | blockquote | table | table.cals | media)
+
 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ p ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 p = element p { p.content }
@@ -271,7 +436,7 @@
 blockquote.attributes =
    blockquote.type.attribute?
 blockquote.type.attribute = attribute type { xsd:NCName }
-   
+
 blockquote.content =
    block.head?,
    (p | speech | \list)+,
@@ -458,12 +623,12 @@
 h.attribute = attribute h { xsd:token {pattern = "\d{1,2}(\.\d{1,2})?%"} }
 hotspot.display.attribute = attribute display { "normal" | "visible" | "pulse" }
 hotspot.type.attribute = attribute type { xsd:NCName }
-   
+
 hotspot.content =
    ((link | p+ | image | audio | video), (spot, scenario?)?)
  | (spot, scenario?)
- | empty 
-   
+ | empty
+
 # ~~~~~~ spot
 spot = element spot { spot.attributes, spot.content }
 
@@ -544,172 +709,6 @@
 
 
 # =============================================================================
-#                                 HEAD LEVEL
-# =============================================================================
-
-# ~~~~~~~~~~~~~~~~~~~~~~~ title, shorttitle, subtitle ~~~~~~~~~~~~~~~~~~~~~~~~~
-
-title = element title { title.content }
-shorttitle = element shorttitle { title.content }
-subtitle = element subtitle { title.content }
-
-title.content = inlines
-
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ identifier ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-# ~~~~~~ identifier
-identifier = element identifier {
-   (attribute type { "ean" }, for.attribute?, xsd:token {pattern = "\d{13}"})
- | (attribute type { "uri" }, for.attribute?, xsd:anyURI)
-}
-
-# ~~~~~~ identifier.ean
-identifier.ean = element identifier {
-   attribute type { "ean" }, for.attribute?, xsd:token {pattern = "\d{13}"}
-}
-
-# ~~~~~~ identifier.uri
-identifier.uri = element identifier {
-   attribute type { "uri" }, for.attribute?, xsd:anyURI
-}
-
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ copyright ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-copyright = element copyright { copyright.content }
-
-copyright.content = simple.inlines
-
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ collection ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-collection = element collection { collection.content }
-
-collection.content = simple.inlines
-
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ contributors ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-# ~~~~~~ contributors
-contributors = element contributors { contributors.content }
-
-contributors.content =
-   contributor+
-
-# ~~~~~~ contributor
-contributor = element contributor { contributor.content }
-
-contributor.content =
-   identifier.uri?,
-   (((firstname, secondname?)?, lastname) | label),
-   address?,
-   link?,
-   role+
-
-# ~~~~~~ firstname, secondname, lastname, label
-firstname = element firstname { firstname.content }
-secondname = element secondname { secondname.content }
-lastname = element lastname { lastname.content }
-label = element label { label.content }
-
-firstname.content = simple.inlines
-secondname.content = simple.inlines
-lastname.content = simple.inlines
-label.content = simple.inlines
-
-# ~~~~~~ address
-address = element address { address.content }
-
-address.content = simple.inlines
-
-# ~~~~~~ role
-role = element role { role.content }
-
-role.content = "author" | "illustrator" | "publisher" | "packager"
-
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ place ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-place = element place { place.content }
-
-place.content = simple.inlines
-
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ source ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-source = element source {
-   (  (attribute type { "book" }, bibliography.entry.content)
-    | (attribute type { "file" }, source.content.file)),
-   source.content
-}
-
-source.content.file =
-   identifier.uri
-source.content =
-   annotation*
-
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ keyword & subject ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-# ~~~~~~ keywordset
-keywordset = element keywordset { keywordset.content }
-
-keywordset.content = keyword+
-
-# ~~~~~~ keyword
-keyword = element keyword { keyword.content }
-
-keyword.content = simple.inlines
-
-# ~~~~~~ subjectset
-subjectset = element subjectset { subjectset.content }
-
-subjectset.content = subject+
-
-# ~~~~~~ subject
-subject = element subject { subject.content }
-
-subject.content = simple.inlines
-
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ index ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-# ~~~~~~ index
-index = element index { index.content }
-head.index = element index { head.index.content }
-
-index.content =
-   (index.w, index.entry?)
- | (index.entry, (index.w | index.entry)?)
-head.index.content =
-   index.entry, index.entry?
-
-# ~~~~~~ index.w
-index.w = element w { simple.inlines }
-
-# ~~~~~~ index.entry
-index.entry = element entry { simple.inlines }
-
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ abstract ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-abstract = element abstract { abstract.content }
-
-abstract.content =
-   p+
-
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cover ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-cover = element cover { cover.content }
-
-cover.content =
-   cover.image
-
-cover.image = element image { cover.image.attributes }
-
-cover.image.attributes =
-   media.id.attribute
-   
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ annotation ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-annotation = element annotation { annotation.content }
-
-annotation.content = inlines
-
-
-# =============================================================================
 #                                 INLINE LEVEL
 # =============================================================================
 
--- a/RelaxNG/publiquiz.rnc	mer. avril 16 13:07:05 2014 +0200
+++ b/RelaxNG/publiquiz.rnc	jeu. avril 24 20:36:03 2014 +0200
@@ -31,7 +31,7 @@
 #                                  TOP LEVEL
 # =============================================================================
 
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ quiz ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ top.quiz ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 top.quiz = element quiz { top.quiz.attributes, top.quiz.content }
 
@@ -49,8 +49,9 @@
    help?,
    answer?
 
+
 # =============================================================================
-#                               COMPONENT LEVEL
+#                                COMPONENT LEVEL
 # =============================================================================
 
 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ quiz ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -58,10 +59,9 @@
 quiz = element quiz { quiz.attributes, quiz.content }
 
 quiz.attributes =
-   (quiz.id.attribute | quiz.xmlid.attribute)?
+   (quiz.id.attribute | xmlid.attribute)?
  & quiz.type.attribute?
  & lang.attribute?
-quiz.xmlid.attribute = attribute xml:id { xsd:ID }
 
 quiz.content =
    component.head?,
@@ -189,12 +189,20 @@
 
 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ categories ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
+# ~~~~~~ category.head
+category.head = element head { category.head.content }
+
+category.head.content =
+   title,
+   shorttitle?,
+   subtitle*
+
 # ~~~~~~ categories
 categories = element categories { categories.attributes, categories.content }
 
 categories.attributes =
    multiple.attribute?
-   
+
 categories.content =
    category.item*,
    category,
@@ -206,14 +214,6 @@
 category.content =
    category.head,
    category.item*
-   
-# ~~~~~~ category.head
-category.head = element head { category.head.content }
-
-category.head.content =
-   title,
-   shorttitle?,
-   subtitle*
 
 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ pip ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
@@ -236,7 +236,7 @@
 
 composite.attributes =
    multipage.attribute?
-multipage.attribute = attribute multipage { xsd:boolean } 
+multipage.attribute = attribute multipage { xsd:boolean }
 
 composite.content =
    subquiz,
@@ -390,7 +390,7 @@
 
 blanks.dropzone.attributes =
    x.attribute
- & y.attribute   
+ & y.attribute
 pip.dropzone.attributes =
    x.attribute
  & y.attribute
--- a/RelaxNG/publiset.rnc	mer. avril 16 13:07:05 2014 +0200
+++ b/RelaxNG/publiset.rnc	jeu. avril 24 20:36:03 2014 +0200
@@ -16,146 +16,6 @@
    (composition | selection)+
 
 
-# =============================================================================
-#                                  TOP LEVEL
-# =============================================================================
-
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ composition ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-# ~~~~~~ composition
-composition = element composition {
-   composition.attributes,
-   composition.content
-}
-
-composition.attributes =
-   composition.id.attribute
- & path.attribute?
- & (xpath.attribute | xslt.attribute)?
- & remap.attributes
- & lang.attribute?
-composition.id.attribute = attribute id { xsd:NMTOKEN }
-path.attribute = attribute path { xsd:anyURI }
-xslt.attribute = attribute xslt { xsd:anyURI }
-xpath.attribute = attribute xpath { text }
-lang.attribute = attribute xml:lang { xsd:language }
-
-composition.content =
-   composition.head?,
-   (composition.division | composition.file)+
-
-# ~~~~~~ composition.head
-composition.head = element head {
-   composition.head.attributes, composition.head.content }
-
-composition.head.attributes =
-   remap.attributes
-
-composition.head.content =
-   (title, shorttitle?, subtitle*)?
- & identifier*
- & copyright*
- & collection?
- & contributors?
- & date?
- & (source, source?)?
- & keywordset?
- & subjectset?
- & head.index*
- & abstract?
- & cover?
-
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ selection ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-# ~~~~~~ selection
-selection = element selection {
-   selection.attributes,
-   selection.content
-}
-
-selection.attributes =
-   selection.id.attribute
- & path.attribute?
- & lang.attribute?
-selection.id.attribute = attribute id { xsd:NMTOKEN }
-
-selection.content =
-   selection.head?,
-   (selection.division | selection.file | link)+
-
-# ~~~~~~ selection.head
-selection.head = element head { composition.head.content }
-
-
-# =============================================================================
-#                                DIVISION LEVEL
-# =============================================================================
-
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ division ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-# ~~~~~~ division
-composition.division = element division {
-   composition.division.attributes,
-   composition.division.content
-}
-selection.division = element division {
-   selection.division.attributes,
-   selection.division.content
-}
-
-composition.division.attributes =
-   path.attribute?
- & (xpath.attribute | xslt.attribute)?
- & remap.attributes
-selection.division.attributes =
-   path.attribute?
-
-composition.division.content =
-   composition.head?,
-   (composition.division | composition.file)+
-selection.division.content =
-   selection.head?,
-   (selection.division | selection.file | link)+
-
-# ~~~~~~ division.head
-division.head = element head { division.head.content }
-
-division.head.content =
-   (title, shorttitle?, subtitle*)?
- & head.index*
-
-
-# =============================================================================
-#                                  FILE LEVEL
-# =============================================================================
-
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ file ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-composition.file = element file { composition.file.attributes, file.content }
-selection.file = element file { selection.file.attributes, file.content }
-
-composition.file.attributes =
-   path.attribute?
- & (xpath.attribute | xslt.attribute)?
- & argument.attribute?
-selection.file.attributes =
-   path.attribute?
-argument.attribute = attribute argument { text }
-   
-file.content = xsd:anyURI
-
-
-# =============================================================================
-#                                 BLOCK LEVEL
-# =============================================================================
-
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ p ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-p = element p { p.content }
-
-p.content =
-   inlines
-
 
 # =============================================================================
 #                                  HEAD LEVEL
@@ -324,6 +184,147 @@
 
 
 # =============================================================================
+#                                  TOP LEVEL
+# =============================================================================
+
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ composition ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+# ~~~~~~ composition
+composition = element composition {
+   composition.attributes,
+   composition.content
+}
+
+composition.attributes =
+   composition.id.attribute
+ & path.attribute?
+ & (xpath.attribute | xslt.attribute)?
+ & remap.attributes
+ & lang.attribute?
+composition.id.attribute = attribute id { xsd:NMTOKEN }
+path.attribute = attribute path { xsd:anyURI }
+xslt.attribute = attribute xslt { xsd:anyURI }
+xpath.attribute = attribute xpath { text }
+lang.attribute = attribute xml:lang { xsd:language }
+
+composition.content =
+   composition.head?,
+   (composition.division | composition.file)+
+
+# ~~~~~~ composition.head
+composition.head = element head {
+   composition.head.attributes, composition.head.content }
+
+composition.head.attributes =
+   remap.attributes
+
+composition.head.content =
+   (title, shorttitle?, subtitle*)?
+ & identifier*
+ & copyright*
+ & collection?
+ & contributors?
+ & date?
+ & (source, source?)?
+ & keywordset?
+ & subjectset?
+ & head.index*
+ & abstract?
+ & cover?
+
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ selection ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+# ~~~~~~ selection
+selection = element selection {
+   selection.attributes,
+   selection.content
+}
+
+selection.attributes =
+   selection.id.attribute
+ & path.attribute?
+ & lang.attribute?
+selection.id.attribute = attribute id { xsd:NMTOKEN }
+
+selection.content =
+   selection.head?,
+   (selection.division | selection.file | link)+
+
+# ~~~~~~ selection.head
+selection.head = element head { composition.head.content }
+
+
+# =============================================================================
+#                                DIVISION LEVEL
+# =============================================================================
+
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ division ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+# ~~~~~~ division
+composition.division = element division {
+   composition.division.attributes,
+   composition.division.content
+}
+selection.division = element division {
+   selection.division.attributes,
+   selection.division.content
+}
+
+composition.division.attributes =
+   path.attribute?
+ & (xpath.attribute | xslt.attribute)?
+ & remap.attributes
+selection.division.attributes =
+   path.attribute?
+
+composition.division.content =
+   composition.head?,
+   (composition.division | composition.file)+
+selection.division.content =
+   selection.head?,
+   (selection.division | selection.file | link)+
+
+# ~~~~~~ division.head
+division.head = element head { division.head.content }
+
+division.head.content =
+   (title, shorttitle?, subtitle*)?
+ & head.index*
+
+
+# =============================================================================
+#                                  FILE LEVEL
+# =============================================================================
+
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ file ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+composition.file = element file { composition.file.attributes, file.content }
+selection.file = element file { selection.file.attributes, file.content }
+
+composition.file.attributes =
+   path.attribute?
+ & (xpath.attribute | xslt.attribute)?
+ & argument.attribute?
+selection.file.attributes =
+   path.attribute?
+argument.attribute = attribute argument { text }
+   
+file.content = xsd:anyURI
+
+
+# =============================================================================
+#                                 BLOCK LEVEL
+# =============================================================================
+
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ p ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+p = element p { p.content }
+
+p.content =
+   inlines
+
+
+# =============================================================================
 #                                 INLINE LEVEL
 # =============================================================================