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@29: & path.attribute? patrick@29: & xpath.attribute? patrick@29: & xslt.attribute? patrick@0: & remap.attributes patrick@0: composition.id.attribute = attribute xml:id { xsd:ID } patrick@29: path.attribute = attribute path { xsd:anyURI } patrick@29: xslt.attribute = attribute xslt { xsd:anyURI } patrick@29: xpath.attribute = attribute xpath { text } patrick@0: patrick@0: composition.content = patrick@20: composition.head?, patrick@30: (composition.division | composition.file)+ 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@29: selection.id.attribute patrick@29: & path.attribute? patrick@0: selection.id.attribute = attribute xml:id { xsd:ID } patrick@0: patrick@0: selection.content = patrick@20: selection.head?, patrick@30: (selection.division | selection.file | link)+ 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@34: & identifier* patrick@18: & language? patrick@39: & copyright? patrick@5: & author* patrick@5: & publisher? patrick@35: & cover? 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@34: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ identifier ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ patrick@34: patrick@38: identifier.uri = element identifier { patrick@38: attribute type { "uri" }, xsd:anyURI patrick@38: } patrick@34: patrick@38: identifier.ean = element identifier { patrick@38: attribute type { "ean" }, xsd:token {pattern = "\d{13}"} patrick@38: } patrick@34: patrick@38: identifier = identifier.uri | identifier.ean patrick@34: 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@39: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ copyright ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ patrick@39: patrick@39: copyright = element copyright { copyright.content } patrick@39: patrick@39: copyright.content = inlines patrick@39: patrick@5: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ author, publisher ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ patrick@5: patrick@5: # ~~~~~~ author patrick@5: author = element author { author.content } patrick@5: patrick@34: author.attributes = patrick@34: role.attribute? patrick@34: role.attribute = attribute role { "author" | "illustrator" } patrick@34: patrick@5: author.content = patrick@5: firstname?, patrick@34: lastname, patrick@34: role* patrick@5: patrick@5: # ~~~~~~ publisher patrick@5: publisher = element publisher { publisher.content } patrick@5: patrick@34: publisher.content = patrick@34: label, patrick@36: link? 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@34: # ~~~~~~ role patrick@34: role = element role { role.attributes } patrick@34: patrick@34: role.attributes = patrick@34: role.of.attribute patrick@34: role.of.attribute = attribute of { "author" | "illustrator" } patrick@34: patrick@38: # ~~~~~~ label patrick@38: label = element label { label.content } patrick@38: patrick@38: label.content = inlines patrick@38: patrick@35: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cover ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ patrick@35: patrick@35: cover = element cover { cover.content } patrick@35: patrick@35: cover.content = patrick@35: cover.image patrick@35: patrick@35: cover.image = element image { cover.image.attributes } patrick@35: patrick@35: cover.image.attributes = patrick@35: cover.image.id.attribute patrick@35: cover.image.id.attribute = attribute id { xsd:NMTOKEN } patrick@35: 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@29: & xpath.attribute? patrick@23: & xslt.attribute? patrick@0: & remap.attributes patrick@0: selection.division.attributes = patrick@26: path.attribute? 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@30: (selection.division | selection.file | link)+ patrick@0: patrick@0: patrick@0: # ============================================================================= patrick@20: # FILE LEVEL patrick@0: # ============================================================================= patrick@0: patrick@0: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ file ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ patrick@0: patrick@30: composition.file = element file { composition.file.attributes } patrick@2: selection.file = element file { selection.file.attributes, file.content } patrick@0: patrick@0: composition.file.attributes = patrick@30: name.attribute patrick@30: & xpath.attribute? patrick@29: & xslt.attribute? patrick@0: & remap.attributes patrick@0: selection.file.attributes = patrick@30: name.attribute patrick@30: & uri.attribute? patrick@30: name.attribute = attribute name { xsd:anyURI } patrick@0: patrick@30: file.content = inlines patrick@30: patrick@30: 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@36: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ link ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ patrick@36: patrick@36: link = element link { link.attributes, link.content } patrick@36: patrick@36: link.attributes = patrick@36: uri.attribute patrick@36: uri.attribute = attribute uri { xsd:anyURI } patrick@36: patrick@36: link.content = inlines patrick@36: 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+"})+ }}