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@382: composition Patrick@382: | selection patrick@0: 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@127: shorttitle = element shorttitle { title.content } patrick@18: subtitle = element subtitle { title.content } patrick@2: patrick@0: title.content = inlines patrick@0: patrick@34: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ identifier ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ patrick@34: Patrick@256: # ~~~~~~ identifier Patrick@257: identifier = element identifier { Patrick@257: (attribute type { "ean" }, for.attribute?, xsd:token {pattern = "\d{13}"}) Patrick@257: | (attribute type { "uri" }, for.attribute?, xsd:anyURI) Patrick@257: } Patrick@257: Patrick@258: for.attribute = attribute for { xsd:NCName } Patrick@258: Patrick@257: # ~~~~~~ identifier.ean Patrick@257: identifier.ean = element identifier { Patrick@257: attribute type { "ean" }, for.attribute?, xsd:token {pattern = "\d{13}"} Patrick@257: } patrick@34: Patrick@256: # ~~~~~~ identifier.uri Patrick@257: identifier.uri = element identifier { Patrick@257: attribute type { "uri" }, for.attribute?, xsd:anyURI Patrick@257: } patrick@34: patrick@39: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ copyright ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ patrick@39: patrick@39: copyright = element copyright { copyright.content } patrick@39: Patrick@288: copyright.content = simple.inlines patrick@39: Patrick@155: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ collection ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Patrick@155: Patrick@155: collection = element collection { collection.content } Patrick@155: Patrick@288: collection.content = simple.inlines Patrick@155: 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@263: identifier.uri?, patrick@66: (((firstname, secondname?)?, lastname) | label), patrick@66: address?, patrick@66: link?, patrick@101: 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@288: firstname.content = simple.inlines Patrick@288: secondname.content = simple.inlines Patrick@288: lastname.content = simple.inlines Patrick@288: label.content = simple.inlines patrick@5: patrick@66: # ~~~~~~ address patrick@66: address = element address { address.content } patrick@5: Patrick@288: address.content = simple.inlines patrick@5: patrick@34: # ~~~~~~ role patrick@66: role = element role { role.content } patrick@34: Patrick@444: role.content = "author" | "illustrator" | "photographer" | "publisher" Patrick@444: | "packager" | "translator" patrick@38: Patrick@259: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ source ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Patrick@259: Patrick@259: source = element source { Patrick@259: ( (attribute type { "book" }, source.content.book) Patrick@259: | (attribute type { "file" }, source.content.file)) Patrick@259: } Patrick@259: Patrick@259: source.content.book = Patrick@259: identifier.ean? Patrick@259: & title Patrick@259: & subtitle? Patrick@259: & copyright? Patrick@259: & collection? Patrick@259: & folio? Patrick@259: & pages? Patrick@350: Patrick@259: source.content.file = Patrick@259: identifier.uri Patrick@259: Patrick@259: # ~~~~~~ folio Patrick@259: folio = element folio { folio.content } Patrick@259: Patrick@259: folio.content = xsd:positiveInteger | xsd:token {pattern = "[DLXVI]+"} Patrick@259: Patrick@259: # ~~~~~~ pages Patrick@259: pages = element pages { pages.content } Patrick@259: Patrick@259: pages.content = xsd:positiveInteger Patrick@259: Patrick@189: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ keyword & subject ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ patrick@98: patrick@98: # ~~~~~~ keywordset patrick@98: keywordset = element keywordset { keywordset.content } patrick@98: patrick@98: keywordset.content = keyword+ patrick@98: patrick@98: # ~~~~~~ keyword patrick@98: keyword = element keyword { keyword.content } patrick@98: Patrick@288: keyword.content = simple.inlines patrick@98: Patrick@189: # ~~~~~~ subjectset Patrick@189: subjectset = element subjectset { subjectset.content } Patrick@189: Patrick@189: subjectset.content = subject+ Patrick@189: Patrick@189: # ~~~~~~ subject Patrick@189: subject = element subject { subject.content } Patrick@189: Patrick@288: subject.content = simple.inlines Patrick@288: Patrick@288: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ index ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Patrick@288: Patrick@361: # ~~~~~~ indexset Patrick@361: indexset = element indexset { indexset.content } Patrick@361: Patrick@361: indexset.content = head.index+ Patrick@361: Patrick@288: # ~~~~~~ index Patrick@288: head.index = element index { head.index.content } Patrick@288: Patrick@288: head.index.content = Patrick@288: index.entry, index.entry? Patrick@288: Patrick@288: # ~~~~~~ index.entry Patrick@288: index.entry = element entry { simple.inlines } Patrick@189: 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@288: media.id.attribute Patrick@288: media.id.attribute = attribute id { xsd:NMTOKEN } patrick@35: Patrick@362: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ element ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Patrick@362: Patrick@362: \element = element element { element.attributes, element.content } Patrick@362: Patrick@362: element.attributes = Patrick@362: name.attribute Patrick@362: name.attribute = attribute name { xsd:NCName } Patrick@362: Patrick@362: element.content = Patrick@362: (inlines | \element+) Patrick@362: patrick@0: patrick@0: # ============================================================================= Patrick@310: # TOP LEVEL Patrick@310: # ============================================================================= Patrick@310: Patrick@310: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ composition ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Patrick@310: Patrick@310: # ~~~~~~ composition Patrick@310: composition = element composition { Patrick@310: composition.attributes, Patrick@310: composition.content Patrick@310: } Patrick@310: Patrick@310: composition.attributes = Patrick@382: composition.id.attribute? Patrick@317: & lang.attribute? Patrick@323: & path.attribute? Patrick@418: & pi-fid.attribute? Patrick@317: & pi-source.attribute? Patrick@310: & (xpath.attribute | xslt.attribute)? Patrick@310: & remap.attributes Patrick@310: composition.id.attribute = attribute id { xsd:NMTOKEN } Patrick@317: lang.attribute = attribute xml:lang { xsd:language } Patrick@323: path.attribute = attribute path { xsd:anyURI } Patrick@418: pi-fid.attribute = attribute pi-fid { xsd:boolean } Patrick@317: pi-source.attribute = attribute pi-source { xsd:boolean } Patrick@323: xpath.attribute = attribute xpath { text } Patrick@310: xslt.attribute = attribute xslt { xsd:anyURI } Patrick@310: Patrick@310: composition.content = Patrick@310: composition.head?, Patrick@310: (composition.division | composition.file)+ Patrick@310: Patrick@310: # ~~~~~~ composition.head Patrick@310: composition.head = element head { Patrick@310: composition.head.attributes, composition.head.content } Patrick@310: Patrick@310: composition.head.attributes = Patrick@310: remap.attributes Patrick@310: Patrick@310: composition.head.content = Patrick@384: (title & shorttitle? & subtitle*)? Patrick@310: & identifier* Patrick@310: & copyright* Patrick@310: & collection? Patrick@310: & contributors? Patrick@310: & date? Patrick@310: & (source, source?)? Patrick@310: & keywordset? Patrick@310: & subjectset? Patrick@361: & indexset? Patrick@310: & abstract? Patrick@310: & cover? Patrick@362: & \element* Patrick@310: Patrick@310: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ selection ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Patrick@310: Patrick@310: # ~~~~~~ selection Patrick@310: selection = element selection { Patrick@310: selection.attributes, Patrick@310: selection.content Patrick@310: } Patrick@310: Patrick@310: selection.attributes = Patrick@382: selection.id.attribute? Patrick@317: & lang.attribute? Patrick@310: & path.attribute? Patrick@310: selection.id.attribute = attribute id { xsd:NMTOKEN } Patrick@310: Patrick@310: selection.content = Patrick@310: selection.head?, Patrick@310: (selection.division | selection.file | link)+ Patrick@310: Patrick@310: # ~~~~~~ selection.head Patrick@310: selection.head = element head { composition.head.content } Patrick@310: Patrick@310: Patrick@310: # ============================================================================= Patrick@310: # DIVISION LEVEL Patrick@310: # ============================================================================= Patrick@310: Patrick@310: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ division ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Patrick@310: Patrick@310: # ~~~~~~ division Patrick@310: composition.division = element division { Patrick@310: composition.division.attributes, Patrick@310: composition.division.content Patrick@310: } Patrick@310: selection.division = element division { Patrick@310: selection.division.attributes, Patrick@310: selection.division.content Patrick@310: } Patrick@310: Patrick@310: composition.division.attributes = Patrick@310: path.attribute? Patrick@310: & (xpath.attribute | xslt.attribute)? Patrick@310: & remap.attributes Patrick@400: & argument.attribute? Patrick@405: & mode.attribute? Patrick@310: selection.division.attributes = Patrick@310: path.attribute? Patrick@400: & argument.attribute? Patrick@405: & mode.attribute? Patrick@310: Patrick@310: composition.division.content = Patrick@310: composition.head?, Patrick@310: (composition.division | composition.file)+ Patrick@310: selection.division.content = Patrick@310: selection.head?, Patrick@310: (selection.division | selection.file | link)+ Patrick@310: Patrick@310: Patrick@310: # ============================================================================= Patrick@310: # FILE LEVEL Patrick@310: # ============================================================================= Patrick@310: Patrick@310: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ file ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Patrick@310: Patrick@310: composition.file = element file { composition.file.attributes, file.content } Patrick@310: selection.file = element file { selection.file.attributes, file.content } Patrick@310: Patrick@310: composition.file.attributes = Patrick@310: path.attribute? Patrick@310: & (xpath.attribute | xslt.attribute)? Patrick@310: & argument.attribute? Patrick@405: & mode.attribute? Patrick@446: & title.attribute? Patrick@310: selection.file.attributes = Patrick@310: path.attribute? Patrick@310: argument.attribute = attribute argument { text } Patrick@405: mode.attribute = attribute mode { text } Patrick@446: title.attribute = attribute title { text } Patrick@350: Patrick@310: file.content = xsd:anyURI Patrick@310: Patrick@310: Patrick@310: # ============================================================================= Patrick@310: # BLOCK LEVEL Patrick@310: # ============================================================================= Patrick@310: Patrick@310: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ p ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Patrick@310: Patrick@310: p = element p { p.content } Patrick@310: Patrick@310: p.content = Patrick@310: inlines Patrick@310: Patrick@310: Patrick@310: # ============================================================================= patrick@20: # INLINE LEVEL patrick@0: # ============================================================================= patrick@0: patrick@0: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ inlines ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ patrick@0: Patrick@288: simple.inlines = mixed { patrick@0: sup* patrick@0: & sub* Patrick@288: } Patrick@288: Patrick@293: inlines = mixed { Patrick@293: sup* Patrick@293: & sub* Patrick@293: patrick@126: & highlight* Patrick@288: & emphasis* Patrick@350: & name* Patrick@293: } patrick@0: patrick@0: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub, sup ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ patrick@0: Patrick@288: sup = element sup { simple.inlines } patrick@0: patrick@0: sub = element sub { inlines } patrick@0: patrick@126: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ highlight ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ patrick@126: patrick@126: highlight = element highlight { highlight.content } patrick@126: patrick@126: highlight.content = inlines patrick@126: Patrick@288: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ emphasis ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Patrick@288: Patrick@288: emphasis = element emphasis { emphasis.content } Patrick@288: Patrick@288: emphasis.content = inlines Patrick@288: Patrick@350: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ name ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Patrick@350: Patrick@350: name = element name { name.attributes, name.content } Patrick@350: Patrick@350: name.attributes = Patrick@350: name.of.attribute? Patrick@350: name.of.attribute = attribute of { Patrick@350: "person" | "company" | "book" | "newspaper" | "party" | "movie" Patrick@350: | "painting" } Patrick@350: Patrick@350: name.content = mixed { sup* } Patrick@350: Patrick@350: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ date ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Patrick@350: Patrick@350: date = element date { date.attributes, date.content } Patrick@350: Patrick@350: date.attributes = Patrick@350: date.value.attribute Patrick@350: date.value.attribute = attribute value { xsd:date | xsd:gYearMonth | xsd:gYear } Patrick@350: Patrick@350: date.content = mixed { sup* } Patrick@350: 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@288: link.content = simple.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@97: & transform.attribute? patrick@0: as.attribute = attribute as { xsd:QName } patrick@0: attributes.attribute = patrick@0: attribute attributes {list { (xsd:token {pattern = "\c+=\S+"})+ }} patrick@97: transform.attribute = attribute transform { xsd:anyURI }