<!--
	MusicXML score.dtd

	Version 1.1 - 20 May 2005
	
	Copyright © 2004-2005 Recordare LLC.
	http://www.recordare.com/
	
	This MusicXML work is being provided by the copyright
	holder under the MusicXML Document Type Definition 
	Public License Version 1.02, available from:
	
		http://www.recordare.com/dtds/license.html
-->

<!--
	Works and movements are optionally identified by number
	and title. The work element also may indicate a link
	to the opus document that composes multiple movements
	into a collection.
-->
<!ELEMENT work (work-number?, work-title?, opus?)>
<!ELEMENT work-number (#PCDATA)>
<!ELEMENT work-title (#PCDATA)>

<!ELEMENT opus EMPTY>
<!ATTLIST opus
    %link-attributes; 
>

<!ELEMENT movement-number (#PCDATA)>
<!ELEMENT movement-title (#PCDATA)>

<!--
	Collect score-wide defaults. This includes scaling
	and layout, defined in layout.dtd, and default values
	for the music font, word font, lyric font, and 
	lyric language. The number and name attributes in
	lyric-font and lyric-language elements are typically
	used when lyrics are provided in multiple languages.
	If the number and name attributes are omitted, the 
	lyric-font and lyric-language values apply to all 
	numbers and names.
-->
<!ELEMENT defaults (scaling?, page-layout?,
	system-layout?, staff-layout*, music-font?, 
	word-font?, lyric-font*, lyric-language*)>

<!ELEMENT music-font EMPTY>
<!ATTLIST music-font
	%font;
>
<!ELEMENT word-font EMPTY>
<!ATTLIST word-font
	%font;
>
<!ELEMENT lyric-font EMPTY>
<!ATTLIST lyric-font
    number NMTOKEN #IMPLIED
    name CDATA #IMPLIED
	%font;
>
<!ELEMENT lyric-language EMPTY>
<!ATTLIST lyric-language
    number NMTOKEN #IMPLIED
    name CDATA #IMPLIED
	xml:lang NMTOKEN #REQUIRED
>

<!--
	Credit elements refer to the title, composer, arranger,
	lyricist, copyright, dedication, and other text that
	appears on the first page of a score. The credit-words
	element is similar to the words element for directions.
	However, since the credit is not part of a measure,
	the default-x and default-y attributes adjust the
	origin relative to the bottom left-hand corner of
	the first page. The enclosure is none by default.
-->
<!ELEMENT credit (credit-words+)>
<!ELEMENT credit-words (#PCDATA)>
<!ATTLIST credit-words
    %justify;
    %halign;
    %valign;
    %print-style;
    xml:lang NMTOKEN #IMPLIED
    enclosure (rectangle | oval | none) #IMPLIED
>

<!--
	The part-list identifies the different musical parts in
	this movement. Each part has an ID that is used later
	within the musical data. Since parts may be encoded
	separately and combined later, identification elements
	are present at both the score and score-part levels.
	There must be at least one score-part, combined as
	desired with part-group elements that indicate braces
	and brackets. Parts are ordered from top to bottom in
	a score based on the order in which they appear in the
	part-list.
	
	Each MusicXML part corresponds to a track in a Standard
	MIDI Format 1 file. The score-instrument elements are
	used when there are multiple instruments per track.
	The midi-device element is used to make a MIDI device
	or port assignment for the given track. Initial
	midi-instrument assignments may be made here as well.
-->
<!ELEMENT part-list (part-group*, score-part,
	(part-group | score-part)*)>
<!ELEMENT score-part (identification?, part-name,
	part-abbreviation?, group*, score-instrument*,
	midi-device?, midi-instrument*)>
<!ATTLIST score-part
    id ID #REQUIRED
>

<!--
	The part-name indicates the full name of the musical 
	part. The part-abbreviation indicates the abbreviated
	version of the name of the musical part. The part-name
	will often precede the first system, while the 
	part-abbreviation will precede the other systems.
-->
<!ELEMENT part-name (#PCDATA)>
<!ATTLIST part-name
    %print-style;
    %print-object;
    %justify;
>
<!ELEMENT part-abbreviation (#PCDATA)>
<!ATTLIST part-abbreviation
    %print-style;
    %print-object;
    %justify;
>

<!--
	The part-group element indicates groupings of parts in
	the score, usually indicated by braces and brackets.
	The number attribute is used to distinguish overlapping
	and nested part-groups, not the sequence of groups. As
	with parts, groups can have a name and abbreviation.
	The group-symbol element indicates how the group is 
	indicated on the score. Values include none (default),
	brace, line, and bracket. Values for the child elements
	are ignored at the stop of a group. The group-barline
	element indicates if the group should have common
	barlines. Values can be yes, no, or Mensurstrich.
-->
<!ELEMENT part-group (group-name?, group-abbreviation?,
	group-symbol?, group-barline?, %editorial;)>
<!ATTLIST part-group
    type %start-stop; #REQUIRED
    number CDATA "1"
>
<!ELEMENT group-name (#PCDATA)>
<!ATTLIST group-name
    %print-style;
    %justify;
>
<!ELEMENT group-abbreviation (#PCDATA)>
<!ATTLIST group-abbreviation
    %print-style;
    %justify;
>
<!ELEMENT group-symbol (#PCDATA)>
<!ATTLIST group-symbol
    %position;
    %color;
>
<!ELEMENT group-barline (#PCDATA)>
<!ATTLIST group-barline
    %color;
>

<!--
	The score-instrument element allows for multiple
	instruments per score-part. As with the score-part
	element, each score-instrument has a required ID
	attribute, a name, and an optional abbreviation.
	A score-instrument element is also required if the
	score specifies MIDI channels, banks, or programs.
	An initial midi-instrument assignment can also
	be made here. MusicXML software should be able to
	automatically assign reasonable channels and 
	instruments without these elements in simple cases,
	such as where part names match General MIDI
	instrument names.
	
	The midi-instrument element is defined in common.dtd,
	as it can be used within both the score-part and
	sound elements.
-->
<!ELEMENT score-instrument
	(instrument-name, instrument-abbreviation?)>
<!ATTLIST score-instrument
    id ID #REQUIRED
>
<!ELEMENT instrument-name (#PCDATA)>
<!ELEMENT instrument-abbreviation (#PCDATA)>

<!--
	The midi-device content corresponds to the DeviceName
	meta event in Standard MIDI Files. The optional port
	attribute is a number from 1 to 16 that can be used
	with the unofficial MIDI port (or cable) meta event.
-->
<!ELEMENT midi-device (#PCDATA)>
<!ATTLIST midi-device
    port CDATA #IMPLIED
>

<!--
	The group element allows the use of different versions
	of the part for different purposes. Typical values
	include score, parts, sound, and data. Ordering 
	information that is directly encoded in MuseData can
	be derived from the ordering within a score or opus
	in MusicXML.
-->
<!ELEMENT group (#PCDATA)>

<!--
	Here is the basic musical data that is either associated
	with a part or a measure, depending on whether partwise
	or timewise hierarchy is used.
-->
<!ENTITY % music-data
    "(note | backup | forward | direction | attributes |
      harmony | figured-bass | print | sound | barline | 
      grouping | link | bookmark)*">

<!--
	The score-header entity contains basic score metadata
	about the work and movement, score-wide defaults for
	layout and fonts, credits that appear on the first page,
	and the part list. 
-->
<!ENTITY % score-header
    "(work?, movement-number?, movement-title?,
      identification?, defaults?, credit*, part-list)">

<!--
	The score is the root element for the DTD. It includes
	the score-header entity, followed either by a series of
	parts with measures inside (score-partwise) or a series
	of measures with parts inside (score-timewise). Having
	distinct top-level elements for partwise and timewise
	scores makes it easy to ensure that an XSLT stylesheet
	does not try to transform a document already in the
	desired format.

	The version attribute is new to MusicXML 1.1. It provides
	an easier way to get version information than through the
	MusicXML public ID. The default value is 1.0 to make it 
	possible for programs that handle version 1.1 to 
	distinguish version 1.0 files reliably. Programs that
	write MusicXML 1.1 files should set this attribute.
-->
<![ %partwise; [
<!ELEMENT score-partwise (%score-header;, part+)>
<!ATTLIST score-partwise
    version  CDATA  "1.0"
>	
<!ELEMENT part (measure+)>
<!ELEMENT measure (%music-data;)>
]]>
<![ %timewise; [
<!ELEMENT score-timewise (%score-header;, measure+)>
<!ATTLIST score-timewise
    version  CDATA  "1.0"
>	
<!ELEMENT measure (part+)>
<!ELEMENT part (%music-data;)>
]]>
<!--
	In either format, the part element has an id attribute
	that is an IDREF back to a score-part in the part-list.
	Measures have a required number attribute (going from
	partwise to timewise, measures are grouped via the
	number).
-->
<!ATTLIST part
    id IDREF #REQUIRED
>
<!--
	The implicit attribute is set to "yes" for measures where
	the measure number should never appear, such as pickup
	measures and the last half of mid-measure repeats. The
	value is "no" if not specified.
	
	The non-controlling attribute indicates that this measure
	in this part does not necessarily synchronize with other
	measures in other parts. This is intended for use in
	multimetric music like the Don Giovanni minuet. The
	value is "no" if not specified.

	Measure width is specified in tenths. These are the
	global tenths specified in the scaling element, not
	local tenths as modified by the staff-size element.
-->
<!ATTLIST measure
    number CDATA #REQUIRED
    implicit %yes-no; #IMPLIED
    non-controlling %yes-no; #IMPLIED
    width %tenths; #IMPLIED
>