<!-- ************************************************************** -->
<!--
NAME:     Music Encoding Initiative (MEI) DTD
          File      = meiBase.dtd 
          Vers Date = 2006/09/01

NOTICE:   Copyright (c) 2001-2006 Perry Roland and the Rector and
          Visitors of the University of Virginia.  Licensed under
          the Educational Community License version 1.0.  See
          mei17b.dtd for License details.

PURPOSE:  This file contains declarations for the work-level
          elements in MEI. It is invoked by the mei.dtd driver
          file.

NOTE:     In addition to the elements declared in the meiShared
          module, the meiBase DTD includes on the meiMeas DTD, which
          contains the declaration of the measure element and its
          sub-elements.
                                                                    -->
<!-- ************************************************************** -->

<!-- This element is a container for everything else in the document
besides the header. The front and back elements are declared in the
meiText DTD. -->
<!ELEMENT work  ((%n.front;)?, (%n.music;|%n.group;), (%n.back;)?)>
<!ATTLIST work
          %a.common;>

<!-- The group element enables the gathering of multiple documents
into a single file. Because its model contains the work element,
each of the documents can have its own front and back matter. -->
<!ENTITY % group 'INCLUDE'>
<![%group;[
<!ELEMENT %n.group;  ((work|%n.group;), (work|%n.group;)*)>
<!ATTLIST %n.group;
          meiform            CDATA                 #FIXED 'group'
          %a.common;>
]]>

<!-- The music element contains the actual music data. When the
music can be broken into high-level, discrete, linear segments, such
as movements in the case of a symphony, there may be multiple mdiv
elements within the body. This is the highest level indication of
the structure of the music. The model <!ELEMENT %n.music; (%n.mdiv;)*>
allows the music element to be empty, which might be useful in some
editing/creation situations. -->
<!ENTITY % music 'INCLUDE'>
<![%music;[
<!ELEMENT %n.music;   (%n.mdiv;)+>
<!ATTLIST %n.music;
          meiform            CDATA                 #FIXED 'music'
          %a.common;>
]]>

<!-- The mdiv element may contain one or both of 2 possible views of the
music. The score view is the traditional full and open score while the
parts view contains each performer's view of the score; that is, his
part. These 2 views are necessary because it is not always possible or
desirable to generate one from the other. The score and parts elements
are placed here and not directly within the body element because score
and part characteristics may change from mdiv to mdiv. For example, the
2nd movement of a symphony may require different performing forces (and
therefore different score and part layout) than the other movements.
Another possible model is <!ELEMENT mdiv (score?, parts?, sourcedesc*)>
which allows meta-data to accompany an mdiv. However, this creates a
dependency between the meiBase DTD and the meiHead DTD. -->
<!ENTITY % mdiv 'INCLUDE'>
<![%mdiv;[
<!ELEMENT %n.mdiv; ((%n.score;)?, (%n.parts;)?)>
<!ATTLIST %n.mdiv;
          meiform            CDATA                 #FIXED 'mdiv'
          %a.common;>
]]>

<!-- Full score view of the mdiv. Since the measure element is optional,
a score may consist entirely of pagebreaks, each of which points to
a page image. The measure element is declared in the meiMeas DTD and the
pb element is declared in the meiShared DTD. Div elements are allowed
preceding and following sections of music data in order to
accommodate blocks of explanatory text. -->
<!ENTITY % score 'INCLUDE'>
<![%score;[
<!ELEMENT %n.score; (
                      %n.scoredef;
                      | %n.staffgrp;
                      | %n.staffdef;
                      | (%n.section;, (%n.ending;)*)
                      | %n.div;
                      %scoreorg;
                      %apparatus;
                    )*>
<!ATTLIST %n.score;
          meiform            CDATA                 #FIXED 'score'
          %a.common;
          %a.log.score;
          %a.vis.score;
          %a.ges.score;
          %a.anl.score;>
]]>

<!-- Container for score meta-information. -->
<!ENTITY % scoredef 'INCLUDE'>
<![%scoredef;[
<!ELEMENT %n.scoredef;  ((%n.chordtable;)?, (%n.symboltable;)?,
                        (%n.pghead1;)?, (%n.pghead2;)?, (%n.pgfoot1;)?,
                        (%n.pgfoot2;)?, ((%n.staffgrp;)?|(%n.staffdef;)?))>
<!ATTLIST %n.scoredef;
          meiform            CDATA                 #FIXED 'scoredef'
          %a.common;
          %a.log.scoredef;
          %a.vis.scoredef;
          %a.ges.scoredef;
          %a.anl.scoredef;>
]]>

<!-- Parts view of the mdiv. -->
<!ENTITY % parts 'INCLUDE'>
<![%parts;[
<!ELEMENT %n.parts;  (%n.part;)*>
<!ATTLIST %n.parts;
          meiform            CDATA                 #FIXED 'parts'
          %a.common;
          %a.log.parts;
          %a.vis.parts;
          %a.ges.parts;
          %a.anl.parts;>
]]>

<!-- A part is an alternative visual rendition of the score from a
particular performer's point of view. Part elements are not used in the
score to indicate voice leading. Next attributes on event elements
should be used for this purpose. Part elements are useful for encoding
individual parts when there is no score, such as early music part books,
when the music has non-aligning barlines, when different layout, such as
page turns, are needed for the score and parts, or for accommodating
software that requires part-by-part encoding. When assembly of the parts
into a score is desired and there are non-aligning barlines, barlines which
indicate points of alignment across all the parts should be marked as
'controlling', while non-aligning ones should be marked as 'non-
controlling'. The measure sub-element is declared in the meiMeas DTD and
the pb sub-element is declared in the meiShared DTD. -->
<!ENTITY % part 'INCLUDE'>
<![%part;[
<!ELEMENT %n.part; (
                      %n.scoredef;
                      | %n.staffgrp;
                      | %n.staffdef;
                      | (%n.section;, (%n.ending;)*)
                      | %n.div;
                      %scoreorg;
                      %apparatus;
                    )*>
<!ATTLIST %n.part;
          meiform            CDATA                 #FIXED 'part'
          %a.common;
          %a.log.part;
          %a.vis.part;
          %a.ges.part;
          %a.anl.part;>
]]>

<!-- Chord/tablature look-up table. A table may be shared between mei
instances through the use of an external parsed entity containing the
look-up table to be shared. -->
<!ENTITY % chordtable 'INCLUDE'>
<![%chordtable;[
<!ELEMENT %n.chordtable; (%n.chorddef;)+>
<!ATTLIST %n.chordtable;
          meiform            CDATA                 #FIXED 'chordtable'
          %a.common;>
]]>

<!-- Chord/tablature definition. An individual chord in the chord
table. An id isn't required here but harm elements can only reference
a particular chorddef via an id. Therefore, if a chorddef will ever be
referenced, an id is necessary. The pos (position) attribute is
provided in order to create displayable chord tablature grids. (Read,
p. 409-410) -->
<!ENTITY % chorddef 'INCLUDE'>
<![%chorddef;[
<!ELEMENT %n.chorddef; ((%n.chordmember;)*, (%n.barre;)*)>
<!ATTLIST %n.chorddef;
          meiform            CDATA                 #FIXED 'chorddef'
          %a.common;
          pos                CDATA                 #IMPLIED>
]]>

<!-- Chord member. An individual pitch in a chord. The fing and fret
attributes are provided in order to create displayable chord tablature
grids. The inth (harmonic interval) attribute gives the number of 1/2
steps above the bass. Of course, for the bass note itself, inth should
be set to '0'. The inth attribute may be used to provide "playable"
chords. -->
<!ENTITY % chordmember 'INCLUDE'>
<![%chordmember;[
<!ELEMENT %n.chordmember; EMPTY>
<!ATTLIST %n.chordmember;
          meiform            CDATA                 #FIXED 'chordmember'
          %a.common;
          acci               %ACCIDENTAL.IMPLICIT; #IMPLIED
          fing               (x|o|1|2|3|4|5)       #IMPLIED
          fret               (1|2|3|4|5)           #IMPLIED
          inth               CDATA                 #IMPLIED
          pname              %PITCHNAME;           #REQUIRED>
]]>

<!-- An indication of fingering in a chord tablature grid. -->
<!ENTITY % barre 'INCLUDE'>
<![%barre;[
<!ELEMENT %n.barre;  EMPTY>
<!ATTLIST %n.barre;
          meiform            CDATA                 #FIXED 'barre'
          %a.common;
          fret               (1|2|3|4|5)           #REQUIRED
          from               IDREF                 #REQUIRED
          to                 IDREF                 #REQUIRED>
]]>

<!-- Symboltable contains individual, user-defined symbols. Like
a chord table, a symboltable may be shared between mei instances
through the use of an external parsed entity containing the
look-up table to be shared. -->
<!ENTITY % symboltable 'INCLUDE'>
<![%symboltable;[
<!ELEMENT %n.symboltable; (%n.symboldef;)+>
<!ATTLIST %n.symboltable;
          meiform            CDATA                 #FIXED 'symboltable'
          %a.common;>
]]>

<!-- Declaration of an individual symbol. The elements referred to
by the %m.primitives entity are declared in the meiShared DTD. -->
<!ENTITY % symboldef 'INCLUDE'>
<![%symboldef;[
<!ELEMENT %n.symboldef; (%m.primitives;|%n.anchoredtext;)+>
<!ATTLIST %n.symboldef;
          meiform            CDATA                 #FIXED 'symboldef'
          %a.common;>
]]>

<!-- Instrtable contains declarations for MIDI instruments.  Instrtable
may be used when multiple MIDI instruments share a staff or staffgrp. -->
<!ENTITY % instrtable 'IGNORE'>
<![%instrtable;[
<!ELEMENT %n.instrtable; (%n.instrdef;)+>
<!ATTLIST %n.instrtable;
          meiform            CDATA                 #FIXED 'instrtable'
          %a.common;>
]]>

<!-- MIDI instrument declaration -->
<!ENTITY % instrdef 'INCLUDE'>
<![%instrdef;[
<!ELEMENT %n.instrdef; EMPTY>
<!ATTLIST %n.instrdef;
          meiform            CDATA                 #FIXED 'instrdef'
          %a.common;
          midi.channel       %MIDICHANNEL;         #IMPLIED
          midi.duty          %PERCENT;             #IMPLIED
          midi.instr         %MIDIVALUE;           #IMPLIED
          midi.instrname     CDATA                 #IMPLIED
          midi.port          %MIDIVALUE;           #IMPLIED
          midi.track         %INTEGER;             #IMPLIED>
]]>

<!-- A running header on the first page. The pgheadN and pgfootN
elements should *not* be used to encode textual notes! -->
<!ENTITY % pghead1 'INCLUDE'>
<![%pghead1;[
<!ELEMENT %n.pghead1; (%n.fw;)>
<!ATTLIST %n.pghead1;
          meiform            CDATA                 #FIXED 'pghead1'
          %a.common;
          %a.text;>
]]>

<!-- A running header on the pages following the first. The pgheadN
and pgfootN elements should *not* be used to encode textual notes! -->
<!ENTITY % pghead2 'INCLUDE'>
<![%pghead2;[
<!ELEMENT %n.pghead2; (%n.fw;)>
<!ATTLIST %n.pghead2;
          meiform            CDATA                 #FIXED 'pghead2'
          %a.common;
          %a.text;>
]]>

<!-- A running footer on the first page. The pgheadN and pgfootN
elements should *not* be used to encode textual notes! -->
<!ENTITY % pgfoot1 'INCLUDE'>
<![%pgfoot1;[
<!ELEMENT %n.pgfoot1; (%n.fw;)>
<!ATTLIST %n.pgfoot1;
          meiform            CDATA                 #FIXED 'pgfoot1'
          %a.common;
          %a.text;>
]]>

<!-- A running header on the pages following the first. The pgheadN
and pgfootN elements should *not* be used to encode textual notes! -->
<!ENTITY % pgfoot2 'INCLUDE'>
<![%pgfoot2;[
<!ELEMENT %n.pgfoot2; (%n.fw;)>
<!ATTLIST %n.pgfoot2;
          meiform            CDATA                 #FIXED 'pgfoot2'
          %a.common;
          %a.text;>
]]>

<!-- A group of staves. Bracketed staff groups may contain other
bracketed or braced staff groups or single staves. See Read, p. 35-38,
examples p. 434, 438. System is the more proper name for this concept
(Read, p. 37-38). Split staffgrp into bracket and brace elements? -->
<!ENTITY % staffgrp 'INCLUDE'>
<![%staffgrp;[
<!ELEMENT %n.staffgrp;  ((%n.instrdef;)*, (%n.staffgrp;|%n.staffdef;)+,
                         (%n.grpsym;)*)>
<!ATTLIST %n.staffgrp;
          meiform            CDATA                 #FIXED 'staffgrp'
          %a.common;
          %a.log.staffgrp;
          %a.vis.staffgrp;
          %a.ges.staffgrp;
          %a.anl.staffgrp;>
]]>

<!-- Group symbol, i.e., a brace or bracket.  This element may be used
instead of the staffgrp element's symbol attribute when exact
placement or editorial details for the brace must be recorded. -->
<!ENTITY % grpsym 'INCLUDE'>
<![%grpsym;[
<!ELEMENT %n.grpsym;  EMPTY>
<!ATTLIST %n.grpsym;
          meiform            CDATA                 #FIXED 'grpsym'
          %a.common;
          %a.log.grpsym;
          %a.vis.grpsym;
          %a.ges.grpsym;
          %a.anl.grpsym;>
]]>

<!-- Container for staff meta-information. -->
<!ENTITY % staffdef 'INCLUDE'>
<![%staffdef;[
<!ELEMENT %n.staffdef;  ((%n.instrdef;)*, (%n.layerdef;)*)>
<!ATTLIST %n.staffdef;
          meiform            CDATA                 #FIXED 'staffdef'
          %a.common;
          %a.log.staffdef;
          %a.vis.staffdef;
          %a.ges.staffdef;
          %a.anl.staffdef;>
]]>

<!-- Container for layer (e.g. voice) meta-information. -->
<!ENTITY % layerdef 'INCLUDE'>
<![%layerdef;[
<!ELEMENT %n.layerdef;  (%n.instrdef;)*>
<!ATTLIST %n.layerdef;
          meiform            CDATA                 #FIXED 'layerdef'
          %a.common;
          %a.log.layerdef;
          %a.vis.layerdef;
          %a.ges.layerdef;
          %a.anl.layerdef;>
]]>

<!-- The section element contains actual music data. The measure sub-
element is declared in the meiMeas DTD and the pb sub-element is
declared in the meiShared DTD. The linking attributes are available here
so that this element can point to external media objects or to related
internal elements, such as annotations. -->
<!ENTITY % section 'INCLUDE'>
<![%section;[
<!ELEMENT %n.section; (
                      %n.scoredef;
                      | %n.staffgrp;
                      | %n.staffdef;
                      | (%n.section;, (%n.ending;)*)
                      | %n.div;
                      %scoreorg;
                      %apparatus;
                    )*>
<!ATTLIST %n.section;
          meiform            CDATA                 #FIXED 'section'
          %a.common;
          %a.link.common;
          %a.link.external;
          %a.link.internal;
          %a.log.section;
          %a.vis.section;
          %a.ges.section;
          %a.anl.section;>
]]>

<!-- An app (apparatus) element contains parallel alternative
encodings. When an app element is used, there should always be at
least 2 readings. -->
<!ENTITY % app 'INCLUDE'>
<![%app;[
<!ELEMENT %n.app; (rdg, rdg+)>
<!ATTLIST %n.app;
          meiform            CDATA                 #FIXED 'app'
          %a.common; >
]]>

<!-- Reading. Since a reading is a multi-measure section, the scoredef
element is allowed so that a reading may have its own meta-data
without the overhead of child sections. The measure sub-element is
declared in the meiMeas DTD and the pb sub-element is declared in the
meiShared DTD. The app sub-element is permitted in order to allow
nested sub-variants. The rdg element is equivalent to the strophe
element in previous versions. -->
<!ENTITY % rdg 'INCLUDE'>
<![%rdg;[
<!ELEMENT %n.rdg; (
                      %n.scoredef;
                      | %n.staffgrp;
                      | %n.staffdef;
                      | (%n.section;, (%n.ending;)*)
                      | %n.div;
                      %scoreorg;
                      %apparatus;
                    )*>
<!ATTLIST %n.rdg;
          meiform            CDATA                 #FIXED 'rdg'
          %a.common;
          %a.link.common;
          %a.link.external;
          %a.link.internal;
          %a.anl.rdg;
          %a.ges.rdg;
          %a.log.rdg;
          %a.vis.rdg;>
]]>

<!-- Alternative ending. The scoredef element is allowed so that an
ending may have its own meta-data without the overhead of child
<section>s. Div sub-elements are not allowed within ending in order to
avoid collisions with the brackets that are usually displayed over
endings. The measure sub-element is declared in the meiMeas DTD and
the pb sub-element is declared in the meiShared DTD. Endings may *not*
contain endings. -->
<!ENTITY % ending 'INCLUDE'>
<![%ending;[
<!ELEMENT %n.ending; (
                      %n.scoredef;
                      | %n.staffgrp;
                      | %n.staffdef;
                      | (%n.section;, (%n.ending;)*)
                      | %n.div;
                      %scoreorg;
                      %apparatus;
                    )*>
<!ATTLIST %n.ending;
          meiform            CDATA                 #FIXED 'ending'
          %a.common;
          %a.link.common;
          %a.link.external;
          %a.link.internal;
          %a.anl.ending;
          %a.ges.ending;
          %a.log.ending;
          %a.vis.ending;>
]]>

<!-- Forme work, e.g. running header and footer. Auto-generated
page numbers may be indicated by using a processing instruction in
a fwd element. In MEI the fw element is always formatted like a
table. -->
<!ENTITY % fw 'INCLUDE'>
<![%fw;[
<!ELEMENT %n.fw;  (%n.fwr;)+>
<!ATTLIST %n.fw;
          meiform            CDATA                 #FIXED 'fw'
          %a.common;
          %a.text;>
]]>

<!-- Forme work row. A single forme work data cell will typically be
centered, two will be positioned flush left and flush right, while
three will usually be positioned flush left, center, and flush
right.-->
<!ENTITY % fwr 'INCLUDE'>
<![%fwr;[
<!ELEMENT %n.fwr;  (%n.fwd;, (%n.fwd;, (%n.fwd;)?)?)>
<!ATTLIST %n.fwr;
          meiform            CDATA                 #FIXED 'fwr'
          %a.common;
          %a.text;
          %a.xy;>
]]>

<!-- Forme work data cell. Automatically generated page numbers may
be included by using processing instructions. The %m.anchoredtext
entity is employed here instead of %m.textinline in order to restrict
the use of the pb sub-element. --> 
<!ENTITY % fwd 'INCLUDE'>
<![%fwd;[
<!ELEMENT %n.fwd;  (#PCDATA|%m.anchoredtext;)*>
<!ATTLIST %n.fwd;
          meiform            CDATA                 #FIXED 'fwd'
          %a.common;
          %a.text;
          %a.xy;>
]]>

<!-- System break. Allowing staffdef content, i.e.,  <!ELEMENT %n.sb;
(staffdef)*>, here would make it possible to record layout changes
without requiring these changes to be made at section boundaries.
However, it would also allow meter and key changes, which is probably
undesirable. -->
<!ENTITY % sb 'INCLUDE'>
<![%sb;[
<!ELEMENT %n.sb; EMPTY>
<!ATTLIST %n.sb;
          meiform            CDATA                 #FIXED 'sb'
          %a.common;
          %a.log.sb;
          %a.vis.sb;
          %a.ges.sb;
          %a.anl.sb;>
]]>

<!-- The barline element may be used instead of the measure element. It
has the same attributes as measure. It is only available when the
meiMensural entity has been set to INCLUDE. -->
<!ENTITY % barline 'INCLUDE'>
<![%barline;[
<!ELEMENT %n.barline;  EMPTY>
<!ATTLIST %n.barline;
          meiform            CDATA                 #FIXED 'barline'
          %a.common;
          %a.link.common;
          %a.link.internal;
          %a.link.external;
          %a.log.measure;
          %a.vis.measure;
          %a.ges.measure;
          %a.anl.measure;>
]]>

<!-- The ligature element is provided for the encoding of mensural
notation. It is only available when the meiMensural entity has been set
to INCLUDE. -->
<!ENTITY % ligature 'INCLUDE'>
<![%ligature;[
<!ELEMENT %n.ligature;  ((%n.note;|%n.ligature;), (%n.note;|%n.ligature;)+)>
<!ATTLIST %n.ligature;
          meiform            CDATA                 #FIXED 'ligature'
          %a.common;
          %a.log.ligature;
          %a.vis.ligature;
          %a.ges.ligature;
          %a.anl.ligature;>
]]>

<!-- ************************************************************** -->
