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@66: & lang.attribute? 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@66: lang.attribute = attribute xml:lang { xsd:language } 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@66: & lang.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@39: & copyright? patrick@66: & contributors? yvon@52: & abstract? patrick@35: & cover? patrick@20: division.head.content = patrick@20: (title, subtitle?)? 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@39: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ copyright ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ patrick@39: patrick@39: copyright = element copyright { copyright.content } patrick@39: patrick@39: copyright.content = inlines patrick@39: patrick@66: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ contributors ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ patrick@5: patrick@66: # ~~~~~~ contributors patrick@66: contributors = element contributors { contributors.content } patrick@5: patrick@66: contributors.content = patrick@66: contributor+ patrick@34: patrick@66: # ~~~~~~ contributor patrick@66: contributor = element contributor { contributor.content } patrick@66: patrick@66: contributor.content = patrick@66: (((firstname, secondname?)?, lastname) | label), patrick@66: address?, patrick@66: link?, patrick@34: role* patrick@5: patrick@66: # ~~~~~~ firstname, secondname, lastname, label patrick@5: firstname = element firstname { firstname.content } patrick@66: secondname = element secondname { secondname.content } patrick@66: lastname = element lastname { lastname.content } patrick@66: label = element label { label.content } patrick@5: patrick@5: firstname.content = inlines patrick@66: secondname.content = inlines patrick@66: lastname.content = inlines patrick@66: label.content = inlines patrick@5: patrick@66: # ~~~~~~ address patrick@66: address = element address { address.content } patrick@5: patrick@66: address.content = inlines patrick@5: patrick@34: # ~~~~~~ role patrick@66: role = element role { role.content } patrick@34: patrick@66: role.content = "author" | "illustrator" | "publisher" patrick@38: yvon@52: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ abstract ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ yvon@52: yvon@52: abstract = element abstract { abstract.content } yvon@52: yvon@52: abstract.content = yvon@52: p+ yvon@52: 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: 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: # ============================================================================= yvon@52: # BLOCK LEVEL yvon@52: # ============================================================================= yvon@52: yvon@52: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ p ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ yvon@52: yvon@52: p = element p { p.content } yvon@52: yvon@52: p.content = yvon@52: inlines yvon@52: yvon@52: yvon@52: # ============================================================================= 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+"})+ }}