namespace a = "http://relaxng.org/ns/compatibility/annotations/1.0"
namespace rng = "http://relaxng.org/ns/structure/1.0"

# Schema generated 2006-01-30T20:23:54Z
# Copyright 2005 TEI Consortium.
# This is free software; you can redistribute it and/or
#	    modify it under the terms of the GNU General Public
#	    License as published by the Free Software Foundation;
#	    either version 2 of the License, or (at your option) any
#	    later version.
# This material is distributed in the hope that it will be
#	    useful, but WITHOUT ANY WARRANTY; without even the implied
#	    warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
#	    PURPOSE. See the GNU General Public License for more
#	    details.
# You should have received a copy of the GNU General Public
#	    License along with this file; if not, write to the Free
#	    Software Foundation, Inc., 59 Temple Place, Suite 330,
#	    Boston, MA 02111-1307, USA.
# To contact the TEI Consortium use the following addresses.
#	    For general (non-technical) enquiries: 
#		  target="mailto:info@tei-c.org"/>info@tei-c.orgFor membership enquiries: membership@tei-c.orgFor technical enquiries, particularly about the
#		Guidelines, DTDs, schemas, or software available from
#		the TEI-C: editors@tei-c.orgFor up to date information, consult the TEI web site at http://www.tei-c.org/P5

# Definitions from module textstructure

# Set predeclared macros

# 0. predeclared macros

# 1. classes

# 2. elements

TEI =
  ## (TEI document) contains a single TEI-conformant document,
  ## comprising a TEI header and a text, either in isolation or as part of a
  ## teiCorpus element.
  element TEI { TEI.content, TEI.attributes }
TEI.content = teiHeader, \text
TEI.attributes =
  att.global.attributes,
  ## The version of the TEI scheme
  [ a:defaultValue = "5.0" ] attribute version { xsd:decimal }?,
  empty

argument =
  ## A formal list or prose description of the topics addressed by
  ##	a subdivision of a text.
  element argument { argument.content, argument.attributes }
argument.content =
  (model.global*, head)?, (macro.component, model.global*)*
argument.attributes = att.global.attributes, empty
model.divWrapper |= argument
model.pLike.front |= argument

back =
  ## (back matter) contains any appendixes, etc. following the main part of a
  ## text.
  element back { back.content, back.attributes }
back.content =
  (model.frontPart | model.global | model.divWrapper)*,
  ((\div, (\div | model.frontPart | model.global)*)
   | (div1, (div1 | model.frontPart | model.global)*))?,
  model.divWrapper.bottom*
back.attributes = att.global.attributes, att.declaring.attributes, empty

body =
  ## (text body) contains the whole body of a single unitary text, excluding any front or back matter.
  element body { body.content, body.attributes }
body.content =
  (model.divWrapper | model.global)*,
  (((macro.component, model.global*)+,
    ((divGen, model.global*)*,
     ((\div, (\div | divGen | model.global)*)
      | (div0, (div0 | divGen | model.global)*)
      | (div1, (div1 | divGen | model.global)*))?))
   | ((divGen, model.global*)*,
      ((\div, (\div | divGen | model.global)*)
       | (div0, (div0 | divGen | model.global)*)
       | (div1, (div1 | divGen | model.global)*)))),
  model.divWrapper.bottom*
body.attributes = att.global.attributes, att.declaring.attributes, empty

byline =
  ## contains the primary statement of responsibility given for a work
  ## on its title page or at the head or end of the work.
  element byline { byline.content, byline.attributes }
byline.content =
  (text | model.gLike | model.phrase | docAuthor | model.global)*
byline.attributes = att.global.attributes, empty
model.divWrapper |= byline
model.titlepagePart |= byline
model.pLike.front |= byline

closer =
  ## groups together dateline, byline, salutation, and similar
  ## phrases appearing as a final group at the end of a
  ## division, especially of a letter.
  element closer { closer.content, closer.attributes }
closer.content =
  (text
   | model.gLike
   | signed
   | dateline
   | salute
   | model.phrase
   | model.global)*
closer.attributes = att.global.attributes, empty
model.divWrapper.bottom |= closer

dateline =
  ## contains a brief description of the place, date, time, etc. of
  ##	production of a letter, newspaper story, or other work, prefixed or
  ##	suffixed to it as a kind of heading or trailer. 
  element dateline { dateline.content, dateline.attributes }
dateline.content = macro.phraseSeq
dateline.attributes = att.global.attributes, empty
model.divWrapper |= dateline

\div =
  ## (text division) contains a subdivision of the front, body, or back of a
  ## text.
  element div { div.content, div.attributes }
div.content =
  (model.divWrapper | model.global)*,
  ((\div | divGen)+
   | ((macro.component, model.global?)+, (\div | divGen)*)),
  (model.divWrapper | model.divWrapper.bottom)*
div.attributes =
  att.global.attributes,
  att.divLike.attributes,
  att.declaring.attributes,
  empty

div0 =
  ## (level-0 text division) contains the largest possible subdivision of the body
  ## of a text.
  element div0 { div0.content, div0.attributes }
div0.content =
  (model.divWrapper | model.global)*,
  (((div1 | divGen), model.global*)+
   | ((macro.component, model.global*)+,
      ((div1 | divGen), model.global*)*)),
  (model.divWrapper.bottom, model.global*)*
div0.attributes =
  att.global.attributes,
  att.divLike.attributes,
  att.declaring.attributes,
  empty

div1 =
  ## (level-1 text division) contains a first-level subdivision of the front, body, or back
  ## of a text (the largest, if
  ## div0 is not used, the second largest if it is).
  element div1 { div1.content, div1.attributes }
div1.content =
  (model.divWrapper | model.global)*,
  (((div2 | divGen), model.global*)+
   | ((macro.component, model.global*)+,
      ((div2 | divGen), model.global*)*)),
  (model.divWrapper.bottom, model.global*)*
div1.attributes =
  att.global.attributes,
  att.divLike.attributes,
  att.declaring.attributes,
  empty

div2 =
  ## (level-2 text division) contains a second-level subdivision of the front, body, or back of a
  ##  text.
  element div2 { div2.content, div2.attributes }
div2.content =
  (model.divWrapper | model.global)*,
  (((div3 | divGen), model.global*)+
   | ((macro.component, model.global*)+,
      ((div3 | divGen), model.global*)*)),
  (model.divWrapper.bottom, model.global*)*
div2.attributes =
  att.global.attributes,
  att.divLike.attributes,
  att.declaring.attributes,
  empty

div3 =
  ## (level-3 text division) contains a third-level subdivision of the front, body, or back of a
  ##  text.
  element div3 { div3.content, div3.attributes }
div3.content =
  (model.divWrapper | model.global)*,
  (((div4 | divGen), model.global*)+
   | ((macro.component, model.global*)+,
      ((div4 | divGen), model.global*)*)),
  (model.divWrapper.bottom, model.global*)*
div3.attributes =
  att.global.attributes,
  att.divLike.attributes,
  att.declaring.attributes,
  empty

div4 =
  ## (level-4 text division) contains a fourth-level subdivision of the front, body, or back of a
  ##  text.
  element div4 { div4.content, div4.attributes }
div4.content =
  (model.divWrapper | model.global)*,
  (((div5 | divGen), model.global*)+
   | ((macro.component, model.global*)+,
      ((div5 | divGen), model.global*)*)),
  (model.divWrapper.bottom, model.global*)*
div4.attributes =
  att.global.attributes,
  att.divLike.attributes,
  att.declaring.attributes,
  empty

div5 =
  ## (level-5 text division) contains a fifth-level subdivision of the front, body, or back of a
  ##  text.
  element div5 { div5.content, div5.attributes }
div5.content =
  (model.divWrapper | model.global)*,
  (((div6 | divGen), model.global*)+
   | ((macro.component, model.global*)+,
      ((div6 | divGen), model.global*)*)),
  (model.divWrapper.bottom, model.global*)*
div5.attributes =
  att.global.attributes,
  att.divLike.attributes,
  att.declaring.attributes,
  empty

div6 =
  ## (level-6 text division) contains a sixth-level subdivision of the front, body, or back of a
  ##  text.
  element div6 { div6.content, div6.attributes }
div6.content =
  (model.divWrapper | model.global)*,
  (((div7 | divGen), model.global*)+
   | ((macro.component, model.global*)+,
      ((div7 | divGen), model.global*)*)),
  (model.divWrapper.bottom, model.global*)*
div6.attributes =
  att.global.attributes,
  att.divLike.attributes,
  att.declaring.attributes,
  empty

div7 =
  ## (level-7 text division) contains the smallest possible subdivision of the front, body or
  ## back of a text, larger than a paragraph.
  element div7 { div7.content, div7.attributes }
div7.content =
  (model.divWrapper | model.global)*,
  (macro.component, model.global*)+,
  (model.divWrapper.bottom, model.global*)*
div7.attributes =
  att.global.attributes,
  att.divLike.attributes,
  att.declaring.attributes,
  empty

docAuthor =
  ## (document author) contains the name of the author of the document, as given on the
  ## title page (often but not always contained in a byline).
  element docAuthor { docAuthor.content, docAuthor.attributes }
docAuthor.content = macro.phraseSeq
docAuthor.attributes = att.global.attributes, empty
model.titlepagePart |= docAuthor
model.divWrapper |= docAuthor
model.pLike.front |= docAuthor

docDate =
  ## (document date) contains the date of a document, as given
  ## (usually) on a title page.
  element docDate { docDate.content, docDate.attributes }
docDate.content = macro.phraseSeq
docDate.attributes =
  att.global.attributes,
  ## gives the value of the date in a standard form.
  attribute value { data.temporal }?,
  empty
model.titlepagePart |= docDate
model.divWrapper |= docDate
model.pLike.front |= docDate

docEdition =
  ## (document edition) contains an edition statement as presented on a title page of a
  ## document.
  element docEdition { docEdition.content, docEdition.attributes }
docEdition.content = macro.paraContent
docEdition.attributes = att.global.attributes, empty
model.titlepagePart |= docEdition
model.pLike.front |= docEdition

docImprint =
  ## (document imprint) contains the imprint statement (place and date of publication,
  ## publisher name), as given
  ## (usually) at the foot of a title page.
  element docImprint { docImprint.content, docImprint.attributes }
docImprint.content =
  (text
   | model.gLike
   | model.phrase
   | pubPlace
   | docDate
   | publisher
   | model.global)*
docImprint.attributes = att.global.attributes, empty
model.titlepagePart |= docImprint
model.pLike.front |= docImprint

docTitle =
  ## (document title) contains the title of a document, including all its
  ## constituents, as given on a title page.
  element docTitle { docTitle.content, docTitle.attributes }
docTitle.content = model.global*, (titlePart, model.global*)+
docTitle.attributes = att.global.attributes, empty
model.titlepagePart |= docTitle
model.pLike.front |= docTitle

epigraph =
  ## (epigraph) contains a quotation, anonymous or attributed, appearing at
  ## the start of a section or chapter, or on a title page. 
  element epigraph { epigraph.content, epigraph.attributes }
epigraph.content = macro.componentSeq
epigraph.attributes = att.global.attributes, empty
model.divWrapper |= epigraph
model.titlepagePart |= epigraph
model.pLike.front |= epigraph

front =
  ## (front matter) contains any prefatory matter (headers,
  ## title page, prefaces, dedications, etc.)
  ## found  at the start of a document, before the main body.
  element front { front.content, front.attributes }
front.content =
  (model.frontPart | model.global)*,
  ((model.pLike.front, (model.pLike.front | titlePage | model.global)*)
   | (\div, (\div | model.frontPart | model.global)*)
   | (div1, (div1 | model.frontPart | model.global)*))?
front.attributes =
  att.global.attributes, att.declaring.attributes, empty

group =
  ## contains the body of a composite text, grouping together a
  ## sequence of distinct texts (or groups of such texts) which are regarded
  ## as a unit for some purpose, for example the collected works of an
  ## author, a sequence of prose essays, etc.
  element group { group.content, group.attributes }
group.content =
  (model.divWrapper | model.global)*,
  ((\text | group), (\text | group | model.global)*),
  model.divWrapper.bottom*
group.attributes =
  att.global.attributes, att.declaring.attributes, empty

imprimatur =
  ## contains a formal statement authorizing the publication of
  ## a work, sometimes required to appear on a title page or its verso.
  element imprimatur { imprimatur.content, imprimatur.attributes }
imprimatur.content = macro.paraContent
imprimatur.attributes = att.global.attributes, empty
model.titlepagePart |= imprimatur

opener =
  ## groups together dateline, byline, salutation, and similar
  ## phrases appearing as a preliminary group at the start of a
  ## division, especially of a letter.
  element opener { opener.content, opener.attributes }
opener.content =
  (text
   | model.gLike
   | model.phrase
   | argument
   | byline
   | dateline
   | epigraph
   | salute
   | signed
   | model.global)*
opener.attributes = att.global.attributes, empty
model.divWrapper |= opener

salute =
  ## (salutation) contains a salutation or greeting prefixed to a foreword,
  ## dedicatory epistle, or other division of a text, or the
  ## salutation in the closing of a letter, preface, etc.
  element salute { salute.content, salute.attributes }
salute.content = macro.phraseSeq
salute.attributes = att.global.attributes, empty
model.divWrapper |= salute

signed =
  ## (signature) contains the closing salutation, etc., appended to a foreword,
  ## dedicatory epistle, or other division of a text. 
  element signed { signed.content, signed.attributes }
signed.content = macro.phraseSeq
signed.attributes = att.global.attributes, empty
model.divWrapper.bottom |= signed

\text =
  ## contains a single text of any kind, whether unitary or
  ## composite, for example a poem or drama, a collection of essays, a novel,
  ## a dictionary, or a corpus sample.
  element text { text.content, text.attributes }
text.content =
  model.global*,
  (front, model.global*)?,
  (body | group),
  model.global*,
  (back, model.global*)?
text.attributes = att.global.attributes, att.declaring.attributes, empty
model.inter |= \text

titlePage =
  ## (title page) contains the title page of a text, appearing within the front
  ## or back matter. 
  element titlePage { titlePage.content, titlePage.attributes }
titlePage.content =
  model.global*,
  model.titlepagePart,
  (model.titlepagePart | model.global)*
titlePage.attributes =
  att.global.attributes,
  ## classifies the title page according to any convenient typology.
  attribute type { data.enumerated }?,
  empty
model.frontPart |= titlePage

titlePart =
  ## (title part) contains a subsection or division of the title of a work, as
  ## indicated on a title page.
  element titlePart { titlePart.content, titlePart.attributes }
titlePart.content = macro.paraContent
titlePart.attributes =
  att.global.attributes,
  ## specifies the role of this subdivision of the title.
  [ a:defaultValue = "main" ] attribute type { data.enumerated }?,
  empty
model.titlepagePart |= titlePart
model.pLike.front |= titlePart

trailer =
  ## (trailer) contains a closing title or footer appearing at the end of
  ## a division of a text. 
  element trailer { trailer.content, trailer.attributes }
trailer.content = macro.phraseSeq
trailer.attributes = att.global.attributes, empty
model.divWrapper.bottom |= trailer
# 3. macros
