patrick@0: # $Id$ patrick@0: patrick@0: start = publiset patrick@0: patrick@0: patrick@0: publiset = element publiset { patrick@0: publiset.attributes, patrick@0: publiset.content patrick@0: } patrick@0: patrick@0: publiset.attributes = patrick@0: version.attribute patrick@0: version.attribute = attribute version { "1.0" } patrick@0: patrick@0: publiset.content = patrick@0: (composition | selection)+ patrick@0: patrick@0: patrick@0: # ============================================================================= patrick@20: # TOP LEVEL patrick@0: # ============================================================================= patrick@0: patrick@0: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ composition ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ patrick@0: patrick@0: composition = element composition { patrick@0: composition.attributes, patrick@0: composition.content patrick@0: } patrick@0: patrick@0: composition.attributes = patrick@0: composition.id.attribute patrick@0: & remap.attributes patrick@0: composition.id.attribute = attribute xml:id { xsd:ID } patrick@0: patrick@0: composition.content = patrick@20: composition.head?, patrick@0: (composition.file | composition.division)+ patrick@0: patrick@0: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ selection ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ patrick@0: patrick@0: selection = element selection { patrick@0: selection.attributes, patrick@0: selection.content patrick@0: } patrick@0: patrick@0: selection.attributes = patrick@0: base.attribute? patrick@0: selection.id.attribute = attribute xml:id { xsd:ID } patrick@0: patrick@0: selection.content = patrick@20: selection.head?, patrick@0: (selection.file | selection.division)+ patrick@0: patrick@0: patrick@0: # ============================================================================= patrick@20: # HEAD LEVEL patrick@0: # ============================================================================= patrick@0: patrick@20: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ head ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ patrick@0: patrick@20: composition.head = element head { head.attributes, top.head.content } patrick@20: selection.head = element head { top.head.content } patrick@20: division.head = element head { division.head.content } patrick@0: patrick@20: head.attributes = patrick@0: remap.attributes patrick@0: patrick@20: top.head.content = patrick@18: (title, subtitle?)? patrick@18: & language? patrick@5: & author* patrick@5: & publisher? patrick@5: & source? patrick@20: division.head.content = patrick@20: (title, subtitle?)? patrick@20: & language? patrick@0: patrick@0: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ title, subtitle ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ patrick@0: patrick@0: title = element title { title.content } patrick@18: subtitle = element subtitle { title.content } patrick@2: patrick@0: title.content = inlines patrick@0: patrick@18: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ language ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ patrick@18: patrick@18: language = element language { language.attributes } patrick@18: patrick@18: language.attributes = lang.attribute patrick@18: lang.attribute = attribute xml:lang { xsd:language } patrick@0: patrick@5: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ author, publisher ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ patrick@5: patrick@5: # ~~~~~~ author patrick@5: author = element author { author.content } patrick@5: patrick@5: author.content = patrick@5: firstname?, patrick@5: lastname patrick@5: patrick@5: # ~~~~~~ publisher patrick@5: publisher = element publisher { publisher.content } patrick@5: patrick@5: publisher.content = inlines patrick@5: patrick@5: # ~~~~~~ firstname patrick@5: firstname = element firstname { firstname.content } patrick@5: patrick@5: firstname.content = inlines patrick@5: patrick@5: # ~~~~~~ lastname patrick@5: lastname = element lastname { lastname.content } patrick@5: patrick@5: lastname.content = inlines patrick@5: patrick@0: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ source ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ patrick@0: patrick@2: # ~~~~~~ source patrick@0: source = element source { patrick@0: source.attributes, patrick@0: ( (attribute type { "book" }, source.content.book) patrick@0: | (attribute type { "file" })) patrick@0: } patrick@0: patrick@0: source.attributes = patrick@0: source.id.attribute? patrick@0: & remap.attributes patrick@0: source.id.attribute = attribute id { xsd:NMTOKEN } patrick@0: patrick@0: source.content.book = patrick@0: title?, patrick@0: pagenumber? patrick@0: patrick@2: # ~~~~~~ pagenumber patrick@0: pagenumber = element pagenumber { pagenumber.attributes } patrick@2: patrick@0: pagenumber.attributes = patrick@0: pagenumber.value.attribute patrick@0: pagenumber.value.attribute = attribute value { pagenumber.value.enumeration } patrick@0: pagenumber.value.enumeration = xsd:positiveInteger patrick@0: patrick@0: patrick@0: # ============================================================================= patrick@20: # DIVISION LEVEL patrick@0: # ============================================================================= patrick@0: patrick@0: composition.division = element division { patrick@0: composition.division.attributes, patrick@0: composition.division.content patrick@0: } patrick@0: selection.division = element division { patrick@0: selection.division.attributes, patrick@0: selection.division.content patrick@0: } patrick@0: patrick@0: composition.division.attributes = patrick@26: path.attribute? patrick@23: & xslt.attribute? patrick@23: & xpath.attribute? patrick@0: & remap.attributes patrick@0: selection.division.attributes = patrick@26: path.attribute? patrick@26: path.attribute = attribute path { xsd:anyURI } patrick@23: xslt.attribute = attribute xslt { xsd:anyURI } patrick@23: xpath.attribute = attribute xpath { text } patrick@0: patrick@0: composition.division.content = patrick@20: composition.head?, patrick@20: (composition.division | composition.file)+ patrick@0: selection.division.content = patrick@20: selection.head?, patrick@20: (selection.division | selection.file)+ patrick@0: patrick@0: patrick@0: # ============================================================================= patrick@20: # FILE LEVEL patrick@0: # ============================================================================= patrick@0: patrick@0: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ file ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ patrick@0: patrick@2: composition.file = element file { composition.file.attributes, file.content } patrick@2: selection.file = element file { selection.file.attributes, file.content } patrick@0: patrick@0: composition.file.attributes = patrick@23: xslt.attribute? patrick@23: & xpath.attribute? patrick@0: & remap.attributes patrick@0: selection.file.attributes = patrick@2: xpath.attribute? patrick@23: & xslt.attribute? patrick@0: patrick@2: file.content = xsd:anyURI patrick@2: patrick@0: # ============================================================================= patrick@20: # INLINE LEVEL patrick@0: # ============================================================================= patrick@0: patrick@0: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ inlines ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ patrick@0: patrick@0: inlines = mixed { patrick@0: sup* patrick@0: & sub* patrick@0: } patrick@0: patrick@0: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub, sup ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ patrick@0: patrick@0: sup = element sup { inlines } patrick@0: patrick@0: sub = element sub { inlines } patrick@0: patrick@0: patrick@0: # ============================================================================= patrick@20: # REMAP ATTRIBUTES patrick@0: # ============================================================================= patrick@0: patrick@0: remap.attributes = patrick@0: as.attribute? patrick@0: & attributes.attribute? patrick@0: as.attribute = attribute as { xsd:QName } patrick@0: attributes.attribute = patrick@0: attribute attributes {list { (xsd:token {pattern = "\c+=\S+"})+ }}