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@96: # ~~~~~~ composition 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@96: # ~~~~~~ composition.head patrick@96: composition.head = element head { patrick@96: composition.head.attributes, composition.head.content } patrick@96: patrick@96: composition.head.attributes = patrick@96: remap.attributes patrick@96: patrick@96: composition.head.content = patrick@96: (title, subtitle?)? patrick@96: & identifier* patrick@96: & copyright? patrick@96: & contributors? patrick@96: & abstract? patrick@96: & cover? patrick@96: patrick@0: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ selection ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ patrick@0: patrick@96: # ~~~~~~ selection 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@96: # ~~~~~~ selection.head patrick@96: selection.head = element head { composition.head.content } patrick@96: patrick@96: patrick@96: # ============================================================================= patrick@96: # DIVISION LEVEL patrick@96: # ============================================================================= patrick@96: patrick@96: # ~~~~~~ division patrick@96: composition.division = element division { patrick@96: composition.division.attributes, patrick@96: composition.division.content patrick@96: } patrick@96: selection.division = element division { patrick@96: selection.division.attributes, patrick@96: selection.division.content patrick@96: } patrick@96: patrick@96: composition.division.attributes = patrick@96: path.attribute? patrick@96: & xpath.attribute? patrick@96: & xslt.attribute? patrick@96: & transform.attribute? patrick@96: & remap.attributes patrick@96: selection.division.attributes = patrick@96: path.attribute? patrick@96: transform.attribute = attribute transform { xsd:anyURI } patrick@96: patrick@96: composition.division.content = patrick@96: composition.head?, patrick@96: (composition.division | composition.file)+ patrick@96: selection.division.content = patrick@96: selection.head?, patrick@96: (selection.division | selection.file | link)+ patrick@96: patrick@96: # ~~~~~~ division.head patrick@96: division.head = element head { division.head.content } patrick@96: patrick@96: division.head.content = patrick@96: (title, subtitle?)? patrick@96: patrick@96: patrick@96: # ============================================================================= patrick@96: # FILE LEVEL patrick@96: # ============================================================================= patrick@96: patrick@96: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ file ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ patrick@96: patrick@96: composition.file = element file { composition.file.attributes } patrick@96: selection.file = element file { selection.file.attributes, file.content } patrick@96: patrick@96: composition.file.attributes = patrick@96: name.attribute patrick@96: & xpath.attribute? patrick@96: & xslt.attribute? patrick@96: selection.file.attributes = patrick@96: name.attribute patrick@96: & uri.attribute? patrick@96: name.attribute = attribute name { xsd:anyURI } patrick@96: patrick@96: file.content = inlines patrick@96: patrick@96: patrick@96: # ============================================================================= patrick@96: # BLOCK LEVEL patrick@96: # ============================================================================= patrick@96: patrick@96: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ p ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ patrick@96: patrick@96: p = element p { p.content } patrick@96: patrick@96: p.content = patrick@96: inlines patrick@96: patrick@0: patrick@0: # ============================================================================= patrick@20: # HEAD LEVEL patrick@0: # ============================================================================= 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: # 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+"})+ }}