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@0: # 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: & base.attribute? patrick@0: & remap.attributes patrick@0: composition.id.attribute = attribute xml:id { xsd:ID } patrick@0: base.attribute = attribute xml:base { xsd:anyURI } patrick@0: patrick@0: composition.content = patrick@0: composition.metadata?, 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@0: selection.metadata?, patrick@0: (selection.file | selection.division)+ patrick@0: patrick@0: patrick@0: # ============================================================================= patrick@0: # Metadata level patrick@0: # ============================================================================= patrick@0: patrick@0: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ metadata ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ patrick@0: patrick@0: composition.metadata = element metadata { patrick@0: metadata.attributes, patrick@0: metadata.content patrick@0: } patrick@0: selection.metadata = element metadata { metadata.content } patrick@0: patrick@0: metadata.attributes = patrick@0: remap.attributes patrick@0: patrick@0: metadata.content = patrick@0: title?, patrick@0: subtitle?, patrick@0: source? patrick@0: patrick@0: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ title, subtitle ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ patrick@0: patrick@0: title = element title { title.content } patrick@2: patrick@0: title.content = inlines patrick@0: patrick@0: subtitle = element subtitle { title.content } patrick@0: 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@0: # 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@0: base.attribute? patrick@0: & remap.attributes patrick@0: selection.division.attributes = patrick@0: base.attribute? patrick@0: patrick@0: composition.division.content = patrick@0: composition.metadata?, patrick@0: (composition.file | composition.division)+ patrick@0: selection.division.content = patrick@0: selection.metadata?, patrick@0: (selection.file | selection.division)+ patrick@0: patrick@0: patrick@0: # ============================================================================= patrick@0: # 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@2: xpath.attribute? patrick@0: & remap.attributes patrick@0: selection.file.attributes = patrick@2: xpath.attribute? patrick@0: xpath.attribute = attribute xpath { text } patrick@0: patrick@2: file.content = xsd:anyURI patrick@2: patrick@0: # ============================================================================= patrick@0: # 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@0: # 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+"})+ }}