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@20: # 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@20: top.head?, patrick@0: (division+ | topic+) patrick@0: patrick@0: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ topic ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ patrick@0: patrick@18: top.topic = element topic { top.topic.attributes, top.topic.content } patrick@0: patrick@20: top.topic.attributes = patrick@20: topic.id.attribute patrick@20: & topic.type.attribute? patrick@20: topic.id.attribute = attribute xml:id { xsd:ID } patrick@20: topic.type.attribute = attribute type { xsd:NCName } patrick@20: patrick@20: top.topic.content = patrick@20: top.head?, patrick@20: section+ patrick@0: patrick@0: # ============================================================================= patrick@20: # HEAD LEVEL patrick@0: # ============================================================================= patrick@0: patrick@20: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ head ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ patrick@0: patrick@20: top.head = element head { top.head.content } patrick@20: division.head = element head { division.head.content } patrick@20: component.head = element head { component.head.content } patrick@20: section.head = element head { section.head.content } patrick@20: block.head = element head { block.head.content } patrick@0: patrick@20: top.head.content = patrick@18: (title, subtitle?)? patrick@34: & identifier* patrick@18: & language? patrick@0: & author* patrick@0: & publisher? patrick@0: & date? patrick@0: & place? patrick@0: & source* patrick@0: & subjectset? patrick@0: & abstract? patrick@35: & cover? patrick@0: & annotation* patrick@20: division.head.content = patrick@18: (title, subtitle?)? patrick@18: & language? patrick@18: & annotation* patrick@20: component.head.content = patrick@18: (title, subtitle?)? patrick@18: & language? patrick@18: & author* patrick@18: & annotation* patrick@20: section.head.content = patrick@18: (title, subtitle?)? patrick@18: & language? patrick@18: & annotation* patrick@20: block.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@34: identifier = element identifier { identifier.content, identifier.attributes } patrick@34: patrick@34: identifier.attributes = patrick@34: class.attribute patrick@34: class.attribute = attribute class { "uri" | "ean" } patrick@34: patrick@34: identifier.content = xsd:anyURI | xsd:NMTOKEN patrick@34: patrick@18: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ language ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ patrick@18: patrick@18: language = element language { language.attributes } patrick@18: patrick@34: language.attributes = patrick@34: lang.attribute patrick@18: lang.attribute = attribute xml:lang { xsd:language } patrick@0: patrick@0: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ author, publisher ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ patrick@0: patrick@5: # ~~~~~~ author patrick@0: author = element author { author.content } patrick@0: patrick@33: author.attributes = patrick@33: role.attribute? patrick@33: role.attribute = attribute role { "author" | "illustrator" } patrick@33: patrick@0: author.content = patrick@0: firstname?, patrick@33: lastname, patrick@33: role* patrick@33: patrick@5: # ~~~~~~ publisher patrick@0: publisher = element publisher { publisher.content } patrick@0: patrick@34: publisher.content = patrick@34: label, patrick@34: url? 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@34: # ~~~~~~ label patrick@34: label = element label { label.content } patrick@34: patrick@34: label.content = inlines patrick@34: 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@34: # ~~~~~~ url patrick@34: url = element url { url.content } patrick@34: patrick@34: url.content = xsd:anyURI patrick@34: 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@33: pagenumber.value.attribute = attribute value { 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@20: p+ patrick@2: 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: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ annotation ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ patrick@0: patrick@0: annotation = element annotation { annotation.content } patrick@0: patrick@0: annotation.content = inlines patrick@0: patrick@0: patrick@0: # ============================================================================= patrick@20: # 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@20: division.head?, patrick@0: (division+ | topic+) patrick@0: patrick@0: patrick@0: # ============================================================================= patrick@20: # COMPONENT LEVEL patrick@0: # ============================================================================= patrick@0: patrick@0: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ topic ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ patrick@0: patrick@0: topic = element topic { topic.attributes, topic.content } patrick@0: patrick@0: topic.attributes = patrick@0: topic.id.attribute? patrick@0: & topic.type.attribute? patrick@0: patrick@0: topic.content = patrick@20: component.head?, patrick@0: section+ patrick@0: patrick@0: patrick@0: # ============================================================================= patrick@20: # SECTION LEVEL patrick@0: # ============================================================================= patrick@0: patrick@20: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ section ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ patrick@0: patrick@0: section = element section { section.content, section.attributes } patrick@0: patrick@0: section.content = patrick@20: section.head?, 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@20: # BLOCK LEVEL patrick@0: # ============================================================================= patrick@0: patrick@20: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ block ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ patrick@9: patrick@20: block = (p | speech | \list | table | media) patrick@9: patrick@20: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ p ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ patrick@0: patrick@20: p = element p { p.content } patrick@0: patrick@20: p.content = patrick@0: inlines patrick@0: patrick@18: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ speech ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ patrick@18: patrick@18: # ~~~~~~ speech patrick@18: speech = element speech { speech.content } patrick@18: patrick@18: speech.content = patrick@18: speaker?, patrick@18: stage?, patrick@20: p+ patrick@18: patrick@18: # ~~~~~~ speaker patrick@18: speaker = element speaker { speaker.content } patrick@18: patrick@18: speaker.content = inlines patrick@18: patrick@18: # ~~~~~~ stage patrick@18: stage = element stage { stage.content } patrick@18: patrick@18: stage.content = inlines patrick@18: patrick@17: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ list ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ patrick@9: patrick@9: # ~~~~~~ list patrick@9: \list = element list { \list.content } patrick@9: patrick@9: \list.content = patrick@20: block.head?, 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@30: item.content = patrick@30: inlines patrick@30: | 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@17: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ table ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ patrick@17: patrick@17: table = element table { table.content } patrick@17: patrick@17: table.content = patrick@20: block.head?, patrick@17: tgroup+, patrick@17: caption? patrick@17: patrick@17: # ~~~~~~ tgroup patrick@17: tgroup = element tgroup { tgroup.attributes, tgroup.content } patrick@17: patrick@17: tgroup.content = patrick@17: thead?, patrick@17: tfoot?, patrick@17: tbody patrick@17: patrick@17: tgroup.attributes = patrick@17: cols.attribute patrick@17: & align.attribute? patrick@17: & colsep.attribute? patrick@17: & rowsep.attribute? patrick@17: cols.attribute = attribute cols { xsd:positiveInteger } patrick@17: align.attribute = attribute align { "left" | "right" | "center" | "justify" } patrick@17: colsep.attribute = attribute colsep { "0" | "1" } patrick@17: rowsep.attribute = attribute rowsep { "0" | "1" } patrick@17: patrick@17: # ~~~~~~ thead, tfoot, tbody patrick@22: thead = element thead { thead.attributes, thead.content } patrick@22: tfoot = element tfoot { tfoot.attributes, tfoot.content } patrick@22: tbody = element tbody { tbody.attributes, tbody.content } patrick@17: patrick@22: thead.attributes = patrick@22: valign.attribute? patrick@22: tfoot.attributes = patrick@22: valign.attribute? patrick@22: tbody.attributes = patrick@22: valign.attribute? patrick@22: valign.attribute = attribute valign { "top" | "middle" | "bottom" } patrick@22: patrick@17: thead.content = patrick@17: row+ patrick@17: tfoot.content = patrick@17: row+ patrick@17: tbody.content = patrick@17: row+ patrick@17: patrick@17: # ~~~~~~ row patrick@17: row = element row { row.attribute, row.content } patrick@17: patrick@17: row.attribute = patrick@17: valign.attribute? patrick@17: patrick@17: row.content = patrick@17: entry+ patrick@17: patrick@17: # ~~~~~~ entry patrick@17: entry = element entry { entry.content } patrick@17: patrick@17: entry.content = patrick@17: inlines patrick@20: | p+ patrick@17: patrick@17: # ~~~~~~ caption patrick@17: caption = element caption { caption.content } patrick@17: patrick@17: caption.content = patrick@20: inlines patrick@20: | p+ patrick@17: patrick@35: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ media ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ patrick@0: patrick@2: # ~~~~~~ media patrick@0: media = element media { media.content } patrick@0: patrick@0: media.content = patrick@24: block.head?, patrick@0: image+, patrick@35: caption?, patrick@35: url? 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@17: media.id.attribute = attribute id { xsd:NMTOKEN } patrick@0: patrick@0: image.content = patrick@0: copyright? patrick@0: patrick@2: # ~~~~~~ copyright patrick@0: copyright = element copyright { copyright.content } patrick@3: patrick@0: copyright.content = inlines patrick@0: 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@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@25: & link* 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@33: date.of.attribute = attribute of { "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@33: name.of.attribute = attribute of patrick@33: { "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@17: inlines patrick@20: | p+ 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