patrick@0: # $Id$ patrick@0: patrick@0: start = publidoc patrick@0: patrick@0: patrick@0: publidoc = element publidoc { patrick@0: publidoc.attributes, patrick@0: publidoc.content patrick@0: } patrick@0: patrick@0: publidoc.attributes = patrick@0: version.attribute patrick@0: version.attribute = attribute version { "1.0" } patrick@0: patrick@0: publidoc.content = patrick@0: document patrick@0: | top.topic patrick@0: patrick@0: patrick@0: # ============================================================================= patrick@0: # Top level patrick@0: # ============================================================================= patrick@0: patrick@0: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ document ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ patrick@0: patrick@0: document = element document { document.attributes, document.content } patrick@0: patrick@0: document.attributes = patrick@0: document.id.attribute patrick@0: document.id.attribute = attribute xml:id { xsd:ID } patrick@0: patrick@0: document.content = patrick@0: metadata?, patrick@0: (division+ | topic+) patrick@0: patrick@0: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ topic ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ patrick@0: patrick@0: top.topic = element topic { top.topic.attributes, topic.content } patrick@0: patrick@0: patrick@0: # ============================================================================= patrick@0: # Metadata level patrick@0: # ============================================================================= patrick@0: patrick@0: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ metadata ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ patrick@0: patrick@0: metadata = element metadata { metadata.content } patrick@0: patrick@0: metadata.content = patrick@0: title patrick@0: & subtitle? patrick@0: & author* patrick@0: & publisher? patrick@0: & language? patrick@0: & date? patrick@0: & place? patrick@0: & source* patrick@0: & subjectset? patrick@0: & abstract? patrick@0: & annotation* 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: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ author, publisher ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ patrick@0: patrick@5: # ~~~~~~ author patrick@0: author = element author { author.content } patrick@0: patrick@0: author.content = patrick@0: firstname?, patrick@0: lastname patrick@0: patrick@5: # ~~~~~~ publisher patrick@0: publisher = element publisher { publisher.content } patrick@0: patrick@0: publisher.content = inlines patrick@0: 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@2: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Language ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ patrick@2: patrick@2: language = element language { language.attributes } patrick@2: patrick@2: language.attributes = lang.attribute patrick@2: lang.attribute = attribute xml:lang { xsd:language } patrick@2: patrick@2: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ place ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ patrick@2: patrick@2: place = element place { place.content } patrick@2: patrick@2: place.content = inlines patrick@2: 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: source.content patrick@0: } patrick@0: patrick@0: source.attributes = patrick@0: source.id.attribute patrick@0: source.id.attribute = attribute id { xsd:NMTOKEN } patrick@0: patrick@0: source.content.book = patrick@0: title, patrick@0: pagenumber* patrick@0: source.content = patrick@0: annotation* 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: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ subject ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ patrick@0: patrick@2: # ~~~~~~ subjectset patrick@0: subjectset = element subjectset { subjectset.content } patrick@0: patrick@0: subjectset.content = subject+ patrick@0: patrick@2: # ~~~~~~ subject patrick@0: subject = element subject { subject.attributes } patrick@2: patrick@0: subject.attributes = patrick@0: subject.id.attribute patrick@0: subject.id.attribute = attribute id { xsd:NMTOKEN } patrick@0: patrick@5: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ abstract ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ patrick@2: patrick@2: abstract = element abstract { abstract.content } patrick@2: patrick@2: abstract.content = patrick@2: parag+ patrick@2: patrick@0: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ annotation ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ patrick@0: patrick@0: annotation = element annotation { annotation.content } patrick@0: patrick@0: annotation.content = inlines patrick@0: patrick@0: patrick@0: # ============================================================================= patrick@0: # Division level patrick@0: # ============================================================================= patrick@0: patrick@0: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ division ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ patrick@0: patrick@0: division = element division { division.content } patrick@0: patrick@0: division.content = patrick@0: metadata?, patrick@0: (division+ | topic+) patrick@0: patrick@0: patrick@0: # ============================================================================= patrick@0: # Component level patrick@0: # ============================================================================= patrick@0: patrick@0: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ topic ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ patrick@0: patrick@0: topic = element topic { topic.attributes, topic.content } patrick@0: patrick@0: top.topic.attributes = patrick@0: topic.id.attribute patrick@0: & topic.type.attribute? patrick@0: topic.attributes = patrick@0: topic.id.attribute? patrick@0: & topic.type.attribute? patrick@0: topic.id.attribute = attribute xml:id { xsd:ID } patrick@0: topic.type.attribute = attribute type { xsd:NCName } patrick@0: patrick@0: topic.content = patrick@0: metadata?, patrick@0: section+ patrick@0: patrick@0: patrick@0: # ============================================================================= patrick@0: # Section level patrick@0: # ============================================================================= patrick@0: patrick@0: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ section ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ patrick@0: patrick@0: section = element section { section.content, section.attributes } patrick@0: patrick@0: section.content = patrick@0: metadata?, patrick@9: (section+ | block+) patrick@0: patrick@0: section.attributes = patrick@0: status.attribute? patrick@0: status.attribute = attribute status { xsd:NCName } patrick@0: patrick@0: patrick@0: # ============================================================================= patrick@0: # Block level patrick@0: # ============================================================================= patrick@0: patrick@9: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ blocks ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ patrick@9: patrick@11: block = (parag | \list | speech | media) patrick@9: patrick@9: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ parag ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ patrick@0: patrick@0: parag = element parag { parag.content } patrick@0: patrick@0: parag.content = patrick@0: inlines patrick@0: & link* patrick@0: patrick@9: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ list ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ patrick@9: patrick@9: # ~~~~~~ list patrick@9: \list = element list { \list.content } patrick@9: patrick@9: \list.content = patrick@9: title?, patrick@13: ( (attribute type {"ordered"} ?, item, item+) patrick@9: | (attribute type {"glossary"}, glossary.item+) ) patrick@9: patrick@9: # ~~~~~~ item patrick@9: item = element item { item.content } patrick@9: patrick@9: item.content = block+ patrick@9: patrick@9: # ~~~~~~ glossary.item patrick@9: glossary.item = element item { glossary.item.content } patrick@9: patrick@9: glossary.item.content = patrick@9: label, patrick@9: block+ patrick@9: patrick@9: # ~~~~~~ label patrick@9: label = element label { label.content } patrick@9: patrick@9: label.content = inlines patrick@9: patrick@13: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ speech ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ patrick@11: patrick@11: # ~~~~~~ speech patrick@11: speech = element speech { speech.content } patrick@11: patrick@11: speech.content = patrick@11: speaker?, patrick@11: stage?, patrick@11: parag+ patrick@11: patrick@11: # ~~~~~~ speaker patrick@11: speaker = element speaker { speaker.content } patrick@11: patrick@11: speaker.content = inlines patrick@11: patrick@11: # ~~~~~~ stage patrick@11: stage = element stage { stage.content } patrick@11: patrick@11: stage.content = inlines patrick@11: patrick@0: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ media ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ patrick@0: patrick@2: # ~~~~~~ media patrick@0: media = element media { media.content } patrick@0: patrick@0: media.content = patrick@0: image+, patrick@0: media.caption? patrick@0: patrick@0: media.id.attribute = attribute id { xsd:NMTOKEN } patrick@0: patrick@2: # ~~~~~~ image patrick@0: image = element image { image.attributes, image.content } patrick@0: patrick@0: image.attributes = patrick@0: media.id.attribute patrick@0: patrick@0: image.content = patrick@0: copyright? patrick@0: patrick@3: # ~~~~~~ caption patrick@3: media.caption = element caption { media.caption.content } patrick@3: patrick@3: media.caption.content = patrick@3: parag+ patrick@3: patrick@2: # ~~~~~~ copyright patrick@0: copyright = element copyright { copyright.content } patrick@3: patrick@0: copyright.content = inlines patrick@0: patrick@0: 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@13: & number* patrick@0: & date* patrick@0: & name* patrick@5: & note* patrick@0: & foreign* patrick@0: & highlight* patrick@5: & mentioned* patrick@5: & quote* patrick@8: & acronym* patrick@8: & term* 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@13: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ number ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ patrick@0: patrick@13: number = element number { patrick@13: ( attribute type {"roman"}, number.attributes, number.roman.content ) patrick@13: | ( number.attributes, number.content) patrick@13: } patrick@13: patrick@13: number.attributes = patrick@13: number.value.attribute? patrick@13: number.value.attribute = attribute value { xsd:integer | xsd:decimal } patrick@13: patrick@13: number.content = mixed { sup* } patrick@13: number.roman.content = xsd:token {pattern = "[dlxvi]+"} patrick@0: patrick@0: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ date ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ patrick@0: patrick@0: date = element date { date.attributes, date.content } patrick@0: patrick@3: date.attributes = patrick@13: date.value.attribute patrick@13: & date.of.attribute? patrick@13: date.value.attribute = attribute value { xsd:date | xsd:gYearMonth | xsd:gYear } patrick@0: date.of.attribute = attribute of { date.of.enumeration } patrick@13: date.of.enumeration = "birth" | "death" patrick@0: patrick@13: date.content = mixed { sup* } patrick@0: patrick@2: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ name ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ patrick@0: patrick@0: name = element name { name.attributes, name.content } patrick@2: patrick@2: name.attributes = patrick@2: name.of.attribute? patrick@0: name.of.attribute = attribute of { name.of.enumeration } patrick@0: name.of.enumeration = "person" | "company" | "book" | "newspaper" | "party" patrick@0: patrick@2: name.content = inlines patrick@2: patrick@5: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ note ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ patrick@0: patrick@5: note = element note { note.attributes, note.content } patrick@0: patrick@5: note.attributes = patrick@5: note.label.attribute? patrick@5: note.label.attribute = attribute label { text } patrick@0: patrick@5: note.content = patrick@2: parag+ patrick@0: patrick@13: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ foreign ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ patrick@0: patrick@0: foreign = element foreign { foreign.attributes, foreign.content } patrick@0: patrick@9: foreign.attributes = patrick@9: lang.attribute? patrick@0: patrick@0: foreign.content = inlines patrick@0: patrick@0: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ highlight ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ patrick@0: patrick@0: highlight = element highlight { highlight.content } patrick@0: patrick@0: highlight.content = inlines patrick@0: patrick@5: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ mentioned ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ patrick@5: patrick@5: mentioned = element mentioned { mentioned.content } patrick@5: patrick@5: mentioned.content = inlines patrick@5: patrick@5: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ quote ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ patrick@5: patrick@5: quote = element quote { quote.content } patrick@5: patrick@5: quote.content = inlines patrick@5: patrick@8: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ acronym ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ patrick@8: patrick@8: acronym = element acronym { acronym.content } patrick@8: patrick@8: acronym.content = inlines patrick@8: patrick@8: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ term ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ patrick@8: patrick@8: term = element term { term.content } patrick@8: patrick@8: term.content = inlines patrick@8: patrick@0: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ link ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ patrick@0: patrick@0: link = element link { link.attributes, link.content } patrick@0: patrick@9: link.attributes = patrick@9: (uri.attribute | idref.attribute)? patrick@9: uri.attribute = attribute uri { xsd:anyURI } patrick@9: idref.attribute = attribute idref { xsd:IDREF } patrick@0: patrick@0: link.content = inlines