<staffDef>

Module
Attributes
@aboveorder, @bar.len, @bar.method, @bar.place, @beam.color, @beam.group, @beam.rend, @beam.rests, @beam.slope, @beloworder, @betweenorder, @class, @clef.color, @clef.dis, @clef.dis.place, @clef.line, @clef.shape, @clef.visible, @copyof, @corresp, @decls, @dir.dist, @divisio, @dur.default, @dynam.dist, @follows, @grid.show, @harm.dist, @instr, @key.accid, @key.mode, @key.pname, @keysig, @keysig.cancelaccid, @keysig.visible, @label, @layerscheme, @lines, @lines.color, @lines.visible, @lyric.align, @lyric.fam, @lyric.name, @lyric.size, @lyric.style, @lyric.weight, @meiversion, @mensur.color, @mensur.dot, @mensur.form, @mensur.loc, @mensur.orient, @mensur.sign, @mensur.size, @mensur.slash, @meter.count, @meter.form, @meter.showchange, @meter.sym, @meter.unit, @meter.visible, @modusmaior, @modusminor, @multi.number, @music.name, @music.size, @n, @next, @notationsubtype, @notationtype, @num, @num.default, @numbase, @numbase.default, @oct.default, @ontheline, @pedal.style, @ppq, @precedes, @prev, @prolatio, @proport.num, @proport.numbase, @reh.dist, @reh.enclose, @resp, @sameas, @scale, @slur.lform, @slur.lwidth, @spacing, @synch, @tab.align, @tab.anchorline, @tempo.dist, @tempus, @text.fam, @text.name, @text.size, @text.style, @text.weight, @tie.lform, @tie.lwidth, @trans.diat, @trans.semi, @tune.Hz, @tune.pname, @tune.temper, @type, @visible, @xml:base, @xml:id
@aboveorder(optional)Describes vertical order of items printed above a staff, from closest to farthest away from the staff.
@bar.len(optional)States the length of bar lines in virtual units. The value must be greater than 0 and is typically equal to 2 times (the number of staff lines - 1); e.g., a value of 8 for a 5-line staff.
@bar.method(optional)Records the method of barring.
@bar.place(optional)Denotes the staff location of bar lines, if the length is non-standard; that is, not equal to 2 times (the number of staff lines - 1).
@beam.color(optional)Color of beams, including those associated with tuplets.
@beam.group(optional)Provides an example of how automated beaming (including secondary beams) is to be performed.
@beam.rend(optional)Encodes whether a beam is "feathered" and in which direction. Allowed values are: "acc" (Beam lines grow farther apart from left to right.), "rit" (Beam lines grow closer together from left to right.), "norm" (Beam lines are equally-spaced over the entire length of the beam.)
@beam.rests(optional)Indicates whether automatically-drawn beams should include rests shorter than a quarter note duration.
@beam.slope(optional)Records the slope of a beam; e.g., in terms of MEI virtual units. Positive values indicate upward slope, negative values indicate slope downward, and a zero value indicates the beam is horizontal.
@beloworder(optional)Describes vertical order of items printed below a staff, from closest to farthest away from the staff.
@betweenorder(optional)Describes vertical order of items printed between staves, from top to bottom.
@class(optional)Contains one or more URIs which denote classification terms that apply to the entity bearing this attribute.
@clef.color(optional)Describes the color of the clef.
@clef.dis(optional)Records the amount of octave displacement to be applied to the clef.
@clef.dis.place(optional)Records the direction of octave displacement to be applied to the clef.
@clef.line(optional)Contains a default value for the position of the clef. The value must be in the range between 1 and the number of lines on the staff. The numbering of lines starts with the lowest line of the staff.
@clef.shape(optional)Encodes a value for the clef symbol.
@clef.visible(optional)Determines whether the clef is to be displayed.
@copyof(optional)Points to an element of which the current element is a copy.
@corresp(optional)Used to point to other elements that correspond to this one in a generic fashion.
@decls(optional)Identifies one or more metadata elements (other than classification terms) within the header, which are understood to apply to the element bearing this attribute and its content.
@dir.dist(optional)Records the default distance from the staff for directives.
@divisio(optional)Describes the divisions of the breve in use in 14th-century Italy.
@dur.default(optional)Contains a default duration in those situations when the first note, rest, chord, etc. in a measure does not have a duration specified.
@dynam.dist(optional)Records the default distance from the staff for dynamic marks.
@follows(optional)points to one or more events in a user-defined collection that are known to be predecessors of the current element.
@grid.show(optional)Determines whether to display guitar chord grids.
@harm.dist(optional)Records the default distance from the staff of harmonic indications, such as guitar chord grids or functional labels.
@instr(optional)Provides a way of pointing to a MIDI instrument definition. It must contain the ID of an <instrDef> element elsewhere in the document.
@key.accid(optional)Contains an accidental for the tonic key, if one is required, e.g., if @key.pname equals c and @key.accid equals s, then a tonic of C# is indicated.
@key.mode(optional)Indicates major, minor, or other tonality.
@key.pname(optional)Holds the pitch name of the tonic key, e.g., c for the key of C.
@keysig(optional)Written key signature.
@keysig.cancelaccid(optional)Determines where cautionary accidentals should be displayed at a key change.
@keysig.visible(optional)Determines whether the key signature is to be displayed.
@label(optional)Captures text to be used to generate a label for the element to which it’s attached, a "tool tip" or prefatory text, for example. Should not be used to record document content.
@layerscheme(optional)Indicates the number of layers and their stem directions.
@lines(optional)Indicates the number of staff lines.
@lines.color(optional)Captures the colors of the staff lines.
@lines.visible(optional)Records whether all staff lines are visible.
@lyric.align(optional)Describes the alignment of lyric syllables associated with a note or chord.
@lyric.fam(optional)Sets the font family default value for lyrics.
@lyric.name(optional)Sets the font name default value for lyrics.
@lyric.size(optional)Sets the default font size value for lyrics.
@lyric.style(optional)Sets the default font style value for lyrics.
@lyric.weight(optional)Sets the default font weight value for lyrics.
@meiversion(recommended)Specifies a generic MEI version label. Allowed values are: "6.0-dev" (Version of MEI), "6.0-dev+anyStart" (Version of MEI All AnyStart customization)
@mensur.color(optional)Records the color of the mensuration sign. Do not confuse this with the musical term 'color' as used in pre-CMN notation.
@mensur.dot(optional)Determines if a dot is to be added to the base symbol.
@mensur.form(optional)Indicates whether the base symbol is written vertically or horizontally. Allowed values are: "horizontal" (Horizontally oriented.), "vertical" (Vertically oriented.)
@mensur.loc(optional)Holds the staff location of the mensuration sign.
@mensur.orient(optional)Describes the rotation or reflection of the base symbol.
@mensur.sign(optional)The base symbol in the mensuration sign/time signature of mensural notation.
@mensur.size(optional)Describes the relative size of the mensuration sign.
@mensur.slash(optional)Indicates the number lines added to the mensuration sign. For example, one slash is added for what we now call 'alla breve'.
@meter.count(optional)Captures the number of beats in a measure, that is, the top number of the meter signature. It must contain a decimal number or an expression that evaluates to a decimal number, such as 2+3 or 3*2.
@meter.form(optional)Contains an indication of how the meter signature should be rendered.
@meter.showchange(optional)Determines whether the old meter signature should be displayed when the meter signature changes.
@meter.sym(optional)Indicates the use of a meter symbol instead of a numeric meter signature, that is, 'C' for common time or 'C' with a slash for cut time.
@meter.unit(optional)Contains the number indicating the beat unit, that is, the bottom number of the meter signature.
@meter.visible(optional)Determines whether the meter signature is to be displayed.
@modusmaior(optional)Describes the maxima-long relationship.
@modusminor(optional)Describes the long-breve relationship.
@multi.number(optional)Indicates whether programmatically calculated counts of multiple measures of rest (mRest) and whole measure repeats (mRpt) in parts should be rendered.
@music.name(optional)Sets the default music font name.
@music.size(optional)Sets the default music font size.
@n(optional)Provides a numeric designation that indicates an element’s position in a sequence of similar elements. Its value must be a non-negative integer.
@next(optional)Used to point to the next event(s) in a user-defined collection.
@notationsubtype(optional)Provides any sub-classification of the notation contained or described by the element, additional to that given by its notationtype attribute.
@notationtype(optional)Contains classification of the notation contained or described by the element bearing this attribute.
@num(optional)Along with numbase, describes duration as a ratio. num is the first value in the ratio, while numbase is the second.
@num.default(optional)Along with numbase.default, describes the default duration as a ratio. num.default is the first value in the ratio.
@numbase(optional)Along with num, describes duration as a ratio. num is the first value in the ratio, while numbase is the second.
@numbase.default(optional)Along with num.default, describes the default duration as a ratio. numbase.default is the second value in the ratio.
@oct.default(optional)Contains a default octave specification for use when the first note, rest, chord, etc. in a measure does not have an octave value specified.
@ontheline(optional)Determines the placement of notes on a 1-line staff. A value of true places all notes on the line, while a value of false places stems-up notes above the line and stems-down notes below the line.
@pedal.style(optional)Determines whether piano pedal marks should be rendered as lines or as terms.
@ppq(optional)Indicates the number of pulses (sometimes referred to as ticks or divisions) per quarter note. Unlike MIDI, MEI permits different values for a score and individual staves.
@precedes(optional)Points to one or more events in a user-defined collection that are known to be successors of the current element.
@prev(optional)Points to the previous event(s) in a user-defined collection.
@prolatio(optional)Describes the semibreve-minim relationship.
@proport.num(optional)Together, proport.num and proport.numbase specify a proportional change as a ratio, e.g., 1:3. Proport.num is for the first value in the ratio.
@proport.numbase(optional)Together, proport.num and proport.numbase specify a proportional change as a ratio, e.g., 1:3. Proport.numbase is for the second value in the ratio.
@reh.dist(optional)Records the default distance from the staff for rehearsal marks.
@reh.enclose(optional)Describes the enclosing shape for rehearsal marks. Allowed values are: "box" (Enclosed by box.), "circle" (Enclosed by circle.), "none" (No enclosing shape.)
@resp(optional)Indicates the agent(s) responsible for some aspect of the text’s transcription, editing, or encoding. Its value must point to one or more identifiers declared in the document header.
@sameas(optional)Points to an element that is the same as the current element but is not a literal copy of the current element.
@scale(optional)Scale factor to be applied to the feature to make it the desired display size.
@slur.lform
@slur.lwidth
@spacing(optional)Records the absolute distance (as opposed to the relative distances recorded in <scoreDef> elements) between this staff and the preceding one in the same system. This value is meaningless for the first staff in a system since the spacing.system attribute indicates the spacing between systems.
@synch(optional)Points to elements that are synchronous with the current element.
@tab.align(optional)Attribute that describes the vertical alignment of tablature symbols. Only applicable in cases where the symbols' vertical position does not communicate other information, such as courses (i.e., only in German lute tablature). Typical values are top and bottom.
@tab.anchorline(optional)Used in German lute tablature where the vertical alignment of tab notes is consistent but cannot be identified using a typical value of @tab.align (i.e., top or bottom). Specifies the horizontal strand corresponding to the @lines attribute on <staffDef> that anchors the vertical position of tab notes. This anchorline is used as the vertical starting position when stacking tab notes into chords. Single tab notes simply occupy this position. Chords "grow upwards" from this position. If the chord extends further than the number of available horizontal strands ("lines") above the anchorline, the entire chord is shifted downward until its top tab note is positioned on the top-most line. (Note that in German lute tablature, the lines are conceptual rather than visible).
@tempo.dist(optional)Records the default distance from the staff for tempo marks.
@tempus(optional)Describes the breve-semibreve relationship.
@text.fam(optional)Provides a default value for the font family name of text (other than lyrics) when this information is not provided on the individual elements.
@text.name(optional)Provides a default value for the font name of text (other than lyrics) when this information is not provided on the individual elements.
@text.size(optional)Provides a default value for the font size of text (other than lyrics) when this information is not provided on the individual elements.
@text.style(optional)Provides a default value for the font style of text (other than lyrics) when this information is not provided on the individual elements.
@text.weight(optional)Provides a default value for the font weight for text (other than lyrics) when this information is not provided on the individual elements.
@tie.lform
@tie.lwidth
@trans.diat(optional)Records the amount of diatonic pitch shift, e.g., C to C♯ = 0, C to D♭ = 1, necessary to calculate the sounded pitch from the written one.
@trans.semi(optional)Records the amount of pitch shift in semitones, e.g., C to C♯ = 1, C to D♭ = 1, necessary to calculate the sounded pitch from the written one.
@tune.Hz(optional)Holds a value for cycles per second, i.e., Hertz, for a tuning reference pitch.
@tune.pname(optional)Holds the pitch name of a tuning reference pitch, i.e., the central tone of a tuning system.
@tune.temper(optional)Provides an indication of the tuning system, just, for example.
@type(optional)Designation which characterizes the element in some sense, using any convenient classification scheme or typology that employs single-token labels.
@visible(optional)Indicates if a feature should be rendered when the notation is presented graphically or sounded when it is presented in an aural form.
@xml:base(optional)Provides a base URI reference with which applications can resolve relative URI references into absolute URI references.
@xml:id(optional)Regularizes the naming of an element and thus facilitates building links between it and other resources. Each id attribute within a document must have a unique value.
(MEI.shared) Attributes that form the basis of the att.common class.
@xml:base(optional)Provides a base URI reference with which applications can resolve relative URI references into absolute URI references.
(MEI.shared) Attributes that uniquely identify an element.
@xml:id(optional)Regularizes the naming of an element and thus facilitates building links between it and other resources. Each id attribute within a document must have a unique value.
(MEI.shared) Attributes that record the version of MEI in use.
@meiversion(recommended)Specifies a generic MEI version label. Allowed values are: "6.0-dev" (Version of MEI), "6.0-dev+anyStart" (Version of MEI All AnyStart customization)
(MEI.shared)
@label(optional)Captures text to be used to generate a label for the element to which it’s attached, a "tool tip" or prefatory text, for example. Should not be used to record document content.
(MEI.shared) Attributes that specify element-to-element relationships.
@copyof(optional)Points to an element of which the current element is a copy.
@corresp(optional)Used to point to other elements that correspond to this one in a generic fashion.
@follows(optional)points to one or more events in a user-defined collection that are known to be predecessors of the current element.
@next(optional)Used to point to the next event(s) in a user-defined collection.
@precedes(optional)Points to one or more events in a user-defined collection that are known to be successors of the current element.
@prev(optional)Points to the previous event(s) in a user-defined collection.
@sameas(optional)Points to an element that is the same as the current element but is not a literal copy of the current element.
@synch(optional)Points to elements that are synchronous with the current element.
(MEI.shared) Provides attributes for elements which may be associated with particular contextual elements within the header.
@decls(optional)Identifies one or more metadata elements (other than classification terms) within the header, which are understood to apply to the element bearing this attribute and its content.
(MEI.shared) Attributes used to supply an integer number designation for an element.
@n(optional)Provides a numeric designation that indicates an element’s position in a sequence of similar elements. Its value must be a non-negative integer.
(MEI.shared) Attributes capturing information regarding responsibility for some aspect of the text's creation, transcription, editing, or encoding.
@resp(optional)Indicates the agent(s) responsible for some aspect of the text’s transcription, editing, or encoding. Its value must point to one or more identifiers declared in the document header.
(MEI.shared) Attributes which can be used to classify features.
@type(optional)Designation which characterizes the element in some sense, using any convenient classification scheme or typology that employs single-token labels.
(MEI.shared) Attributes which can be used to classify features.
@class(optional)Contains one or more URIs which denote classification terms that apply to the entity bearing this attribute.
(MEI.analytical) Analytical domain attributes.
(MEI.analytical) Used by staffDef and scoreDef to provide default values for attributes in the analytical domain that are related to key signatures.
@key.accid(optional)Contains an accidental for the tonic key, if one is required, e.g., if @key.pname equals c and @key.accid equals s, then a tonic of C# is indicated.
@key.mode(optional)Indicates major, minor, or other tonality.
@key.pname(optional)Holds the pitch name of the tonic key, e.g., c for the key of C.
(MEI.gestural) Gestural domain attributes for staffDef in the CMN repertoire.
(MEI.midi) Attributes which identify a MIDI instrument.
@instr(optional)Provides a way of pointing to a MIDI instrument definition. It must contain the ID of an <instrDef> element elsewhere in the document.
(MEI.midi) Attributes that record time-base information.
@ppq(optional)Indicates the number of pulses (sometimes referred to as ticks or divisions) per quarter note. Unlike MIDI, MEI permits different values for a score and individual staves.
(MEI.shared) Attributes that describe tuning.
@tune.Hz(optional)Holds a value for cycles per second, i.e., Hertz, for a tuning reference pitch.
@tune.pname(optional)Holds the pitch name of a tuning reference pitch, i.e., the central tone of a tuning system.
@tune.temper(optional)Provides an indication of the tuning system, just, for example.
(MEI.shared) Logical domain attributes for staffDef.
@lines(optional)Indicates the number of staff lines.
(MEI.shared) Used by staffDef and scoreDef to provide default values for attributes in the logical domain related to clefs.
@clef.shape(optional)Encodes a value for the clef symbol.
@clef.line(optional)Contains a default value for the position of the clef. The value must be in the range between 1 and the number of lines on the staff. The numbering of lines starts with the lowest line of the staff.
@clef.dis(optional)Records the amount of octave displacement to be applied to the clef.
@clef.dis.place(optional)Records the direction of octave displacement to be applied to the clef.
(MEI.shared) Attributes that provide a durational default value.
@dur.default(optional)Contains a default duration in those situations when the first note, rest, chord, etc. in a measure does not have a duration specified.
@num.default(optional)Along with numbase.default, describes the default duration as a ratio. num.default is the first value in the ratio.
@numbase.default(optional)Along with num.default, describes the default duration as a ratio. numbase.default is the second value in the ratio.
(MEI.shared) Attributes that describe duration as a ratio.
@num(optional)Along with numbase, describes duration as a ratio. num is the first value in the ratio, while numbase is the second.
@numbase(optional)Along with num, describes duration as a ratio. num is the first value in the ratio, while numbase is the second.
(MEI.shared) Used by staffDef and scoreDef to provide default values for attributes in the logical domain that are related to key signatures.
@keysig(optional)Written key signature.
(MEI.shared) Used by staffDef and scoreDef to provide default values for attributes in the logical domain related to meter signature.
@meter.count(optional)Captures the number of beats in a measure, that is, the top number of the meter signature. It must contain a decimal number or an expression that evaluates to a decimal number, such as 2+3 or 3*2.
@meter.unit(optional)Contains the number indicating the beat unit, that is, the bottom number of the meter signature.
@meter.sym(optional)Indicates the use of a meter symbol instead of a numeric meter signature, that is, 'C' for common time or 'C' with a slash for cut time.
(MEI) Attributes that provide for classification of notation.
@notationtype(optional)Contains classification of the notation contained or described by the element bearing this attribute.
@notationsubtype(optional)Provides any sub-classification of the notation contained or described by the element, additional to that given by its notationtype attribute.
(MEI.shared) Attributes that record a default value for octave.
@oct.default(optional)Contains a default octave specification for use when the first note, rest, chord, etc. in a measure does not have an octave value specified.
(MEI.shared) Attributes that describe transposition.
@trans.diat(optional)Records the amount of diatonic pitch shift, e.g., C to C♯ = 0, C to D♭ = 1, necessary to calculate the sounded pitch from the written one.
@trans.semi(optional)Records the amount of pitch shift in semitones, e.g., C to C♯ = 1, C to D♭ = 1, necessary to calculate the sounded pitch from the written one.
(MEI.cmn) Logical domain attributes for staffDef in the CMN repertoire.
(MEI.cmn) Used by layerDef, staffDef, and scoreDef to provide default values for attributes in the logical domain related to beaming.
@beam.group(optional)Provides an example of how automated beaming (including secondary beams) is to be performed.
@beam.rests(optional)Indicates whether automatically-drawn beams should include rests shorter than a quarter note duration.
(MEI.mensural) Logical domain attributes for staffDef in the mensural repertoire.
(MEI.mensural) Used by staffDef and scoreDef to provide default values for attributes in the logical domain related to mensuration. The tempus, prolatio, modusmaior, and modusminor attributes (from the att.mensural.shared class) specify the relationship between the four principle levels of note value, , the long, breve, semibreve and minim, in mensural notation. Modusminor describes the long-breve relationship, while tempus describes the breve-semibreve, and prolatio the semibreve-minim relationship, respectively. Modusmaior is for the maxima-long relationship. The proport.* attributes describe augmentation or diminution of the normal value of the notes in mensural notation.
@proport.num(optional)Together, proport.num and proport.numbase specify a proportional change as a ratio, e.g., 1:3. Proport.num is for the first value in the ratio.
@proport.numbase(optional)Together, proport.num and proport.numbase specify a proportional change as a ratio, e.g., 1:3. Proport.numbase is for the second value in the ratio.
(MEI.mensural) Shared attributes in the mensural repertoire.
@modusmaior(optional)Describes the maxima-long relationship.
@modusminor(optional)Describes the long-breve relationship.
@prolatio(optional)Describes the semibreve-minim relationship.
@tempus(optional)Describes the breve-semibreve relationship.
@divisio(optional)Describes the divisions of the breve in use in 14th-century Italy.
(MEI.visual) Visual domain attributes for staffDef.
@layerscheme(optional)Indicates the number of layers and their stem directions.
@lines.color(optional)Captures the colors of the staff lines.
@lines.visible(optional)Records whether all staff lines are visible.
@spacing(optional)Records the absolute distance (as opposed to the relative distances recorded in <scoreDef> elements) between this staff and the preceding one in the same system. This value is meaningless for the first staff in a system since the spacing.system attribute indicates the spacing between systems.
(MEI.shared) Attributes that capture the placement of bar lines.
@bar.len(optional)States the length of bar lines in virtual units. The value must be greater than 0 and is typically equal to 2 times (the number of staff lines - 1); e.g., a value of 8 for a 5-line staff.
@bar.method(optional)Records the method of barring.
@bar.place(optional)Denotes the staff location of bar lines, if the length is non-standard; that is, not equal to 2 times (the number of staff lines - 1).
(MEI.visual) Used by staffDef and scoreDef to provide default values for attributes in the visual domain related to clefs.
@clef.color(optional)Describes the color of the clef.
@clef.visible(optional)Determines whether the clef is to be displayed.
(MEI.shared) Attributes that describe distance from the staff.
@dir.dist(optional)Records the default distance from the staff for directives.
@dynam.dist(optional)Records the default distance from the staff for dynamic marks.
@harm.dist(optional)Records the default distance from the staff of harmonic indications, such as guitar chord grids or functional labels.
@reh.dist(optional)Records the default distance from the staff for rehearsal marks.
@tempo.dist(optional)Records the default distance from the staff for tempo marks.
(MEI.visual) Visual domain attributes
@grid.show(optional)Determines whether to display guitar chord grids.
(MEI.visual) Used by staffDef and scoreDef to provide default values for attributes in the visual domain related to key signatures.
@keysig.cancelaccid(optional)Determines where cautionary accidentals should be displayed at a key change.
@keysig.visible(optional)Determines whether the key signature is to be displayed.
(MEI.shared) Attributes that describe default typography of lyrics.
@lyric.align(optional)Describes the alignment of lyric syllables associated with a note or chord.
@lyric.fam(optional)Sets the font family default value for lyrics.
@lyric.name(optional)Sets the font name default value for lyrics.
@lyric.size(optional)Sets the default font size value for lyrics.
@lyric.style(optional)Sets the default font style value for lyrics.
@lyric.weight(optional)Sets the default font weight value for lyrics.
(MEI.visual) Used by staffDef and scoreDef to provide default values for attributes in the visual domain related to meter signature.
@meter.form(optional)Contains an indication of how the meter signature should be rendered.
@meter.showchange(optional)Determines whether the old meter signature should be displayed when the meter signature changes.
@meter.visible(optional)Determines whether the meter signature is to be displayed.
(MEI.shared) Attributes that indicate programmatic numbering.
@multi.number(optional)Indicates whether programmatically calculated counts of multiple measures of rest (mRest) and whole measure repeats (mRpt) in parts should be rendered.
(MEI.shared) Attributes that capture music font name and size.
@music.name(optional)Sets the default music font name.
@music.size(optional)Sets the default music font size.
(MEI.shared) Attributes that record placement of notes on a single-line staff.
@ontheline(optional)Determines the placement of notes on a 1-line staff. A value of true places all notes on the line, while a value of false places stems-up notes above the line and stems-down notes below the line.
(MEI.shared) Attributes that describe relative size.
@scale(optional)Scale factor to be applied to the feature to make it the desired display size.
(MEI.shared) Attributes that describe items printed near (above, below, or between) staves
@aboveorder(optional)Describes vertical order of items printed above a staff, from closest to farthest away from the staff.
@beloworder(optional)Describes vertical order of items printed below a staff, from closest to farthest away from the staff.
@betweenorder(optional)Describes vertical order of items printed between staves, from top to bottom.
(MEI.shared) Attributes that describe default text typography.
@text.fam(optional)Provides a default value for the font family name of text (other than lyrics) when this information is not provided on the individual elements.
@text.name(optional)Provides a default value for the font name of text (other than lyrics) when this information is not provided on the individual elements.
@text.size(optional)Provides a default value for the font size of text (other than lyrics) when this information is not provided on the individual elements.
@text.style(optional)Provides a default value for the font style of text (other than lyrics) when this information is not provided on the individual elements.
@text.weight(optional)Provides a default value for the font weight for text (other than lyrics) when this information is not provided on the individual elements.
(MEI.shared) Attributes describing whether a feature should be displayed.
@visible(optional)Indicates if a feature should be rendered when the notation is presented graphically or sounded when it is presented in an aural form.
(MEI.cmn) Visual domain attributes for staffDef in the CMN repertoire.
(MEI.visual) Used by layerDef, staffDef, and scoreDef to provide default values for attributes in the visual domain related to beaming.
@beam.color(optional)Color of beams, including those associated with tuplets.
@beam.rend(optional)Encodes whether a beam is "feathered" and in which direction. Allowed values are: "acc" (Beam lines grow farther apart from left to right.), "rit" (Beam lines grow closer together from left to right.), "norm" (Beam lines are equally-spaced over the entire length of the beam.)
@beam.slope(optional)Records the slope of a beam; e.g., in terms of MEI virtual units. Positive values indicate upward slope, negative values indicate slope downward, and a zero value indicates the beam is horizontal.
(MEI.cmn) Used by scoreDef and staffDef to provide default description of piano pedal rendition.
@pedal.style(optional)Determines whether piano pedal marks should be rendered as lines or as terms.
(MEI.cmn) Attributes used by scoreDef and staffDef to provide default information about rehearsal numbers/letters.
@reh.enclose(optional)Describes the enclosing shape for rehearsal marks. Allowed values are: "box" (Enclosed by box.), "circle" (Enclosed by circle.), "none" (No enclosing shape.)
(MEI.cmn) Attributes that describe the rendition of slurs.
@slur.lform
@slur.lwidth
(MEI.cmn) Attributes that describe the rendition of ties.
@tie.lform
@tie.lwidth
(MEI.mensural) Visual domain attributes for the mensural repertoire.
(MEI.visual) Used by staffDef and scoreDef to provide default values for attributes in the visual domain related to mensuration.
@mensur.color(optional)Records the color of the mensuration sign. Do not confuse this with the musical term 'color' as used in pre-CMN notation.
@mensur.dot(optional)Determines if a dot is to be added to the base symbol.
@mensur.form(optional)Indicates whether the base symbol is written vertically or horizontally. Allowed values are: "horizontal" (Horizontally oriented.), "vertical" (Vertically oriented.)
@mensur.loc(optional)Holds the staff location of the mensuration sign.
@mensur.orient(optional)Describes the rotation or reflection of the base symbol.
@mensur.sign(optional)The base symbol in the mensuration sign/time signature of mensural notation.
@mensur.size(optional)Describes the relative size of the mensuration sign.
@mensur.slash(optional)Indicates the number lines added to the mensuration sign. For example, one slash is added for what we now call 'alla breve'.
(MEI.stringtab) Visual domain attributes for staffDef in the tablature repertoire.
@tab.align(optional)Attribute that describes the vertical alignment of tablature symbols. Only applicable in cases where the symbols' vertical position does not communicate other information, such as courses (i.e., only in German lute tablature). Typical values are top and bottom.
@tab.anchorline(optional)Used in German lute tablature where the vertical alignment of tab notes is consistent but cannot be identified using a typical value of @tab.align (i.e., top or bottom). Specifies the horizontal strand corresponding to the @lines attribute on <staffDef> that anchors the vertical position of tab notes. This anchorline is used as the vertical starting position when stacking tab notes into chords. Single tab notes simply occupy this position. Chords "grow upwards" from this position. If the chord extends further than the number of available horizontal strands ("lines") above the anchorline, the entire chord is shifted downward until its top tab note is positioned on the top-most line. (Note that in German lute tablature, the lines are conceptual rather than visible).
@notationsubtype(optional)Provides any sub-classification of the notation contained or described by the element, additional to that given by its notationtype attribute.
@notationtype(optional)Contains classification of the notation contained or described by the element bearing this attribute.
@key.accid(optional)Contains an accidental for the tonic key, if one is required, e.g., if @key.pname equals c and @key.accid equals s, then a tonic of C# is indicated.
@key.mode(optional)Indicates major, minor, or other tonality.
@key.pname(optional)Holds the pitch name of the tonic key, e.g., c for the key of C.
@beam.group(optional)Provides an example of how automated beaming (including secondary beams) is to be performed.
@beam.rests(optional)Indicates whether automatically-drawn beams should include rests shorter than a quarter note duration.
@pedal.style(optional)Determines whether piano pedal marks should be rendered as lines or as terms.
@reh.enclose(optional)Describes the enclosing shape for rehearsal marks. Allowed values are: "box" (Enclosed by box.), "circle" (Enclosed by circle.), "none" (No enclosing shape.)
@slur.lform
@slur.lwidth
@tie.lform
@tie.lwidth
@divisio(optional)Describes the divisions of the breve in use in 14th-century Italy.
@modusmaior(optional)Describes the maxima-long relationship.
@modusminor(optional)Describes the long-breve relationship.
@prolatio(optional)Describes the semibreve-minim relationship.
@proport.num(optional)Together, proport.num and proport.numbase specify a proportional change as a ratio, e.g., 1:3. Proport.num is for the first value in the ratio.
@proport.numbase(optional)Together, proport.num and proport.numbase specify a proportional change as a ratio, e.g., 1:3. Proport.numbase is for the second value in the ratio.
@tempus(optional)Describes the breve-semibreve relationship.
@instr(optional)Provides a way of pointing to a MIDI instrument definition. It must contain the ID of an <instrDef> element elsewhere in the document.
@ppq(optional)Indicates the number of pulses (sometimes referred to as ticks or divisions) per quarter note. Unlike MIDI, MEI permits different values for a score and individual staves.
@aboveorder(optional)Describes vertical order of items printed above a staff, from closest to farthest away from the staff.
@bar.len(optional)States the length of bar lines in virtual units. The value must be greater than 0 and is typically equal to 2 times (the number of staff lines - 1); e.g., a value of 8 for a 5-line staff.
@bar.method(optional)Records the method of barring.
@bar.place(optional)Denotes the staff location of bar lines, if the length is non-standard; that is, not equal to 2 times (the number of staff lines - 1).
@beloworder(optional)Describes vertical order of items printed below a staff, from closest to farthest away from the staff.
@betweenorder(optional)Describes vertical order of items printed between staves, from top to bottom.
@class(optional)Contains one or more URIs which denote classification terms that apply to the entity bearing this attribute.
@clef.dis(optional)Records the amount of octave displacement to be applied to the clef.
@clef.dis.place(optional)Records the direction of octave displacement to be applied to the clef.
@clef.line(optional)Contains a default value for the position of the clef. The value must be in the range between 1 and the number of lines on the staff. The numbering of lines starts with the lowest line of the staff.
@clef.shape(optional)Encodes a value for the clef symbol.
@copyof(optional)Points to an element of which the current element is a copy.
@corresp(optional)Used to point to other elements that correspond to this one in a generic fashion.
@decls(optional)Identifies one or more metadata elements (other than classification terms) within the header, which are understood to apply to the element bearing this attribute and its content.
@dir.dist(optional)Records the default distance from the staff for directives.
@dur.default(optional)Contains a default duration in those situations when the first note, rest, chord, etc. in a measure does not have a duration specified.
@dynam.dist(optional)Records the default distance from the staff for dynamic marks.
@follows(optional)points to one or more events in a user-defined collection that are known to be predecessors of the current element.
@harm.dist(optional)Records the default distance from the staff of harmonic indications, such as guitar chord grids or functional labels.
@keysig(optional)Written key signature.
@label(optional)Captures text to be used to generate a label for the element to which it’s attached, a "tool tip" or prefatory text, for example. Should not be used to record document content.
@lines(optional)Indicates the number of staff lines.
@lyric.align(optional)Describes the alignment of lyric syllables associated with a note or chord.
@lyric.fam(optional)Sets the font family default value for lyrics.
@lyric.name(optional)Sets the font name default value for lyrics.
@lyric.size(optional)Sets the default font size value for lyrics.
@lyric.style(optional)Sets the default font style value for lyrics.
@lyric.weight(optional)Sets the default font weight value for lyrics.
@meiversion(recommended)Specifies a generic MEI version label. Allowed values are: "6.0-dev" (Version of MEI), "6.0-dev+anyStart" (Version of MEI All AnyStart customization)
@meter.count(optional)Captures the number of beats in a measure, that is, the top number of the meter signature. It must contain a decimal number or an expression that evaluates to a decimal number, such as 2+3 or 3*2.
@meter.sym(optional)Indicates the use of a meter symbol instead of a numeric meter signature, that is, 'C' for common time or 'C' with a slash for cut time.
@meter.unit(optional)Contains the number indicating the beat unit, that is, the bottom number of the meter signature.
@multi.number(optional)Indicates whether programmatically calculated counts of multiple measures of rest (mRest) and whole measure repeats (mRpt) in parts should be rendered.
@music.name(optional)Sets the default music font name.
@music.size(optional)Sets the default music font size.
@n(optional)Provides a numeric designation that indicates an element’s position in a sequence of similar elements. Its value must be a non-negative integer.
@next(optional)Used to point to the next event(s) in a user-defined collection.
@num(optional)Along with numbase, describes duration as a ratio. num is the first value in the ratio, while numbase is the second.
@num.default(optional)Along with numbase.default, describes the default duration as a ratio. num.default is the first value in the ratio.
@numbase(optional)Along with num, describes duration as a ratio. num is the first value in the ratio, while numbase is the second.
@numbase.default(optional)Along with num.default, describes the default duration as a ratio. numbase.default is the second value in the ratio.
@oct.default(optional)Contains a default octave specification for use when the first note, rest, chord, etc. in a measure does not have an octave value specified.
@ontheline(optional)Determines the placement of notes on a 1-line staff. A value of true places all notes on the line, while a value of false places stems-up notes above the line and stems-down notes below the line.
@precedes(optional)Points to one or more events in a user-defined collection that are known to be successors of the current element.
@prev(optional)Points to the previous event(s) in a user-defined collection.
@reh.dist(optional)Records the default distance from the staff for rehearsal marks.
@resp(optional)Indicates the agent(s) responsible for some aspect of the text’s transcription, editing, or encoding. Its value must point to one or more identifiers declared in the document header.
@sameas(optional)Points to an element that is the same as the current element but is not a literal copy of the current element.
@scale(optional)Scale factor to be applied to the feature to make it the desired display size.
@synch(optional)Points to elements that are synchronous with the current element.
@tempo.dist(optional)Records the default distance from the staff for tempo marks.
@text.fam(optional)Provides a default value for the font family name of text (other than lyrics) when this information is not provided on the individual elements.
@text.name(optional)Provides a default value for the font name of text (other than lyrics) when this information is not provided on the individual elements.
@text.size(optional)Provides a default value for the font size of text (other than lyrics) when this information is not provided on the individual elements.
@text.style(optional)Provides a default value for the font style of text (other than lyrics) when this information is not provided on the individual elements.
@text.weight(optional)Provides a default value for the font weight for text (other than lyrics) when this information is not provided on the individual elements.
@trans.diat(optional)Records the amount of diatonic pitch shift, e.g., C to C♯ = 0, C to D♭ = 1, necessary to calculate the sounded pitch from the written one.
@trans.semi(optional)Records the amount of pitch shift in semitones, e.g., C to C♯ = 1, C to D♭ = 1, necessary to calculate the sounded pitch from the written one.
@tune.Hz(optional)Holds a value for cycles per second, i.e., Hertz, for a tuning reference pitch.
@tune.pname(optional)Holds the pitch name of a tuning reference pitch, i.e., the central tone of a tuning system.
@tune.temper(optional)Provides an indication of the tuning system, just, for example.
@type(optional)Designation which characterizes the element in some sense, using any convenient classification scheme or typology that employs single-token labels.
@visible(optional)Indicates if a feature should be rendered when the notation is presented graphically or sounded when it is presented in an aural form.
@xml:base(optional)Provides a base URI reference with which applications can resolve relative URI references into absolute URI references.
@xml:id(optional)Regularizes the naming of an element and thus facilitates building links between it and other resources. Each id attribute within a document must have a unique value.
@tab.align(optional)Attribute that describes the vertical alignment of tablature symbols. Only applicable in cases where the symbols' vertical position does not communicate other information, such as courses (i.e., only in German lute tablature). Typical values are top and bottom.
@tab.anchorline(optional)Used in German lute tablature where the vertical alignment of tab notes is consistent but cannot be identified using a typical value of @tab.align (i.e., top or bottom). Specifies the horizontal strand corresponding to the @lines attribute on <staffDef> that anchors the vertical position of tab notes. This anchorline is used as the vertical starting position when stacking tab notes into chords. Single tab notes simply occupy this position. Chords "grow upwards" from this position. If the chord extends further than the number of available horizontal strands ("lines") above the anchorline, the entire chord is shifted downward until its top tab note is positioned on the top-most line. (Note that in German lute tablature, the lines are conceptual rather than visible).
@beam.color(optional)Color of beams, including those associated with tuplets.
@beam.rend(optional)Encodes whether a beam is "feathered" and in which direction. Allowed values are: "acc" (Beam lines grow farther apart from left to right.), "rit" (Beam lines grow closer together from left to right.), "norm" (Beam lines are equally-spaced over the entire length of the beam.)
@beam.slope(optional)Records the slope of a beam; e.g., in terms of MEI virtual units. Positive values indicate upward slope, negative values indicate slope downward, and a zero value indicates the beam is horizontal.
@clef.color(optional)Describes the color of the clef.
@clef.visible(optional)Determines whether the clef is to be displayed.
@grid.show(optional)Determines whether to display guitar chord grids.
@keysig.cancelaccid(optional)Determines where cautionary accidentals should be displayed at a key change.
@keysig.visible(optional)Determines whether the key signature is to be displayed.
@layerscheme(optional)Indicates the number of layers and their stem directions.
@lines.color(optional)Captures the colors of the staff lines.
@lines.visible(optional)Records whether all staff lines are visible.
@mensur.color(optional)Records the color of the mensuration sign. Do not confuse this with the musical term 'color' as used in pre-CMN notation.
@mensur.dot(optional)Determines if a dot is to be added to the base symbol.
@mensur.form(optional)Indicates whether the base symbol is written vertically or horizontally. Allowed values are: "horizontal" (Horizontally oriented.), "vertical" (Vertically oriented.)
@mensur.loc(optional)Holds the staff location of the mensuration sign.
@mensur.orient(optional)Describes the rotation or reflection of the base symbol.
@mensur.sign(optional)The base symbol in the mensuration sign/time signature of mensural notation.
@mensur.size(optional)Describes the relative size of the mensuration sign.
@mensur.slash(optional)Indicates the number lines added to the mensuration sign. For example, one slash is added for what we now call 'alla breve'.
@meter.form(optional)Contains an indication of how the meter signature should be rendered.
@meter.showchange(optional)Determines whether the old meter signature should be displayed when the meter signature changes.
@meter.visible(optional)Determines whether the meter signature is to be displayed.
@spacing(optional)Records the absolute distance (as opposed to the relative distances recorded in <scoreDef> elements) between this staff and the preceding one in the same system. This value is meaningless for the first staff in a system since the spacing.system attribute indicates the spacing between systems.
Member of
model.staffDefLikeGroups elements that permit declaration of staff properties.
Contained By
(MEI.shared) Groups elements that permit declaration of staff properties.
<ending>Alternative ending for a repeated passage of music; i.e., prima volta, seconda volta, etc.
<measure>Unit of musical time consisting of a fixed number of note values of a given type, as determined by the prevailing meter, and delimited in musical notation by bar lines.
<oStaff>A staff that holds an alternative passage which may be played instead of the original material.
<part>An alternative visual rendition of the score from the point of view of a particular performer (or group of performers).
<score>Full score view of the musical content.
<staff>A group of equidistant horizontal lines on which notes are placed in order to represent pitch or a grouping element for individual 'strands' of notes, rests, etc. that may or may not actually be rendered on staff lines; that is, both diastematic and non-diastematic signs.
<staffGrp>A group of bracketed or braced staves.
<syllable>Neume notation can be thought of as "neumed text". Therefore, the syllable element provides high-level organization in this repertoire.
(MEI.shared) Groups elements that may appear as part of a section.
<abbr>A generic element for 1) a shortened form of a word, including an acronym or 2) a shorthand notation.
<add>Marks an addition to the text.
<corr>Contains the correct form of an apparent erroneous passage.
<damage>Contains an area of damage to the physical medium.
<del>Contains information deleted, marked as deleted, or otherwise indicated as superfluous or spurious in the copy text by an author, scribe, annotator, or corrector.
<expan>Contains the expansion of an abbreviation.
<lem>Contains the lemma, or base text, of a textual variation.
<orig>Contains material which is marked as following the original, rather than being normalized or corrected.
<rdg>Contains a single reading within a textual variation.
<reg>Contains material which has been regularized or normalized in some sense.
<restore>Indicates restoration of material to an earlier state by cancellation of an editorial or authorial marking or instruction.
<section>Segment of music data.
<sic>Contains apparently incorrect or inaccurate material.
<supplied>Contains material supplied by the transcriber or editor for any reason.
<unclear>Contains material that cannot be transcribed with certainty because it is illegible or inaudible in the source.
<measure>Unit of musical time consisting of a fixed number of note values of a given type, as determined by the prevailing meter, and delimited in musical notation by bar lines.
<oStaff>A staff that holds an alternative passage which may be played instead of the original material.
<lem>Contains the lemma, or base text, of a textual variation.
<rdg>Contains a single reading within a textual variation.
<abbr>A generic element for 1) a shortened form of a word, including an acronym or 2) a shorthand notation.
<add>Marks an addition to the text.
<corr>Contains the correct form of an apparent erroneous passage.
<damage>Contains an area of damage to the physical medium.
<del>Contains information deleted, marked as deleted, or otherwise indicated as superfluous or spurious in the copy text by an author, scribe, annotator, or corrector.
<expan>Contains the expansion of an abbreviation.
<orig>Contains material which is marked as following the original, rather than being normalized or corrected.
<reg>Contains material which has been regularized or normalized in some sense.
<restore>Indicates restoration of material to an earlier state by cancellation of an editorial or authorial marking or instruction.
<sic>Contains apparently incorrect or inaccurate material.
<supplied>Contains material supplied by the transcriber or editor for any reason.
<unclear>Contains material that cannot be transcribed with certainty because it is illegible or inaudible in the source.
<syllable>Neume notation can be thought of as "neumed text". Therefore, the syllable element provides high-level organization in this repertoire.
<ending>Alternative ending for a repeated passage of music; i.e., prima volta, seconda volta, etc.
<part>An alternative visual rendition of the score from the point of view of a particular performer (or group of performers).
<score>Full score view of the musical content.
<section>Segment of music data.
<staff>A group of equidistant horizontal lines on which notes are placed in order to represent pitch or a grouping element for individual 'strands' of notes, rests, etc. that may or may not actually be rendered on staff lines; that is, both diastematic and non-diastematic signs.
<staffGrp>A group of bracketed or braced staves.
May Contain
<ambitus>Range of a voice, instrument or piece.
(MEI.shared) Groups elements used to declare a MIDI instrument.
<instrDef>MIDI instrument declaration.
(MEI.shared) Groups elements used to assign a label to other parts of a document.
<label>A container for document text that identifies the feature to which it is attached. For a "tool tip" or other generated label, use the @label attribute.
<labelAbbr>A label on the pages following the first.
(MEI.shared) Groups elements that permit declaration of layer properties.
<layerDef>Container for layer meta-information.
(MEI.shared) Groups elements that may appear in the declaration of staff features.
<clef>Indication of the exact location of a particular note on the staff and, therefore, the other notes as well.
<clefGrp>A set of simultaneously-occurring clefs.
<tuning>Describes the tuning of an instrument.
(MEI.mensural) Groups elements that may appear in the declaration of staff features.
<mensur>Collects information about the metrical relationship between a note value and the next smaller value; that is, either triple or duple.
<proport>Description of note duration as arithmetic ratio.
(MEI.shared) Groups elements that have the same function as a key signature.
<keySig>Written key signature.
(MEI.shared) Groups elements that represent a meter signature.
<meterSig>Written meter signature.
<meterSigGrp>Used to capture alternating, interchanging, mixed or other non-standard meter signatures.
<meterSig>Written meter signature.
<meterSigGrp>Used to capture alternating, interchanging, mixed or other non-standard meter signatures.
<mensur>Collects information about the metrical relationship between a note value and the next smaller value; that is, either triple or duple.
<proport>Description of note duration as arithmetic ratio.
<instrDef>MIDI instrument declaration.
<ambitus>Range of a voice, instrument or piece.
<clef>Indication of the exact location of a particular note on the staff and, therefore, the other notes as well.
<clefGrp>A set of simultaneously-occurring clefs.
<keySig>Written key signature.
<label>A container for document text that identifies the feature to which it is attached. For a "tool tip" or other generated label, use the @label attribute.
<labelAbbr>A label on the pages following the first.
<layerDef>Container for layer meta-information.
<tuning>Describes the tuning of an instrument.
Constraints

StaffDef must have an n attribute.
Either @lines must be present or a preceding staffDef with the same value for @n and @lines must exist.
Only one clef or clefGrp is permitted.
@n must have the same value as the current staff.
Either @lines must be present or a preceding staffDef with matching @n value and @lines must exist.
The clef position must be less than or equal to the number of lines on the staff.
The clef position must be less than or equal to the number of lines on the staff.
The lines.color attribute must have either 1) a single value or 2) the same number of values as there are staff lines.
The lines.color attribute must have either 1) a single value or 2) the same number of values as there are staff lines.
The value of ppq must be a factor of the value of ppq on an ancestor scoreDef.
The value of ppq must be a factor of the value of ppq on a preceding scoreDef.

Declaration
<elementSpec xmlns="http://www.tei-c.org/ns/1.0" rend="add" ident="staffDef" module="MEI.shared">
<gloss xml:lang="en">staff definition</gloss>
<desc xml:lang="en">Container for staff meta-information.</desc>
<classes>
<memberOf key="att.basic"/>
<memberOf key="att.labelled"/>
<memberOf key="att.linking"/>
<memberOf key="att.metadataPointing"/>
<memberOf key="att.nInteger"/>
<memberOf key="att.responsibility"/>
<memberOf key="att.typed"/>
<memberOf key="att.staffDef.anl"/>
<memberOf key="att.staffDef.ges"/>
<memberOf key="att.staffDef.log"/>
<memberOf key="att.staffDef.vis"/>
<memberOf key="model.staffDefLike"/>
</classes>
<content>
<sequence minOccurs="1" maxOccurs="1">
<classRef key="model.labelLike" minOccurs="0" maxOccurs="unbounded"/>
<alternate minOccurs="0" maxOccurs="unbounded">
<classRef key="model.instrDefLike"/>
<classRef key="model.layerDefLike"/>
<classRef key="model.staffDefPart"/>
</alternate>
<elementRef key="ambitus" minOccurs="0"/>
</sequence>
</content>
<constraintSpec ident="Check_staffDefn" scheme="schematron">
<constraint>
<sch:rule context="mei:staffDef[not(ancestor::mei:staff)]">
<sch:let name="thisstaff" value="@n"/>
<sch:assert test="@n">StaffDef must have an n attribute.</sch:assert>
<sch:assert test="@lines or preceding::mei:staffDef[@n=$thisstaff and @lines]"> Either @lines must be present or a preceding staffDef with the same value for @n and @lines must exist.</sch:assert>
<sch:assert test="count(mei:clef) + count(mei:clefGrp) < 2">Only one clef or clefGrp is permitted.</sch:assert>
</sch:rule>
</constraint>
</constraintSpec>
<constraintSpec ident="Check_ancestor_staff" scheme="schematron">
<constraint>
<sch:rule context="mei:staffDef[ancestor::mei:staff and @n]">
<sch:let name="thisstaff" value="@n"/>
<sch:assert test="ancestor::mei:staff/@n eq $thisstaff">@n must have the same value as the current staff.</sch:assert>
</sch:rule>
</constraint>
</constraintSpec>
<constraintSpec ident="Check_ancestor_staff_lines" scheme="schematron">
<constraint>
<sch:rule context="mei:staffDef[ancestor::mei:staff and not(@n)]">
<sch:let name="thisstaff" value="ancestor::mei:staff/@n"/>
<sch:assert test="@lines or preceding::mei:staffDef[@n=$thisstaff and @lines]"> Either @lines must be present or a preceding staffDef with matching @n value and @lines must exist.</sch:assert>
</sch:rule>
</constraint>
</constraintSpec>
<constraintSpec ident="Check_clef_position_staffDef" scheme="schematron">
<constraint>
<sch:rule context="mei:staffDef[@clef.line and @lines]">
<sch:assert test="number(@clef.line) <= number(@lines)">The clef position must be less than or equal to the number of lines on the staff.</sch:assert>
</sch:rule>
</constraint>
</constraintSpec>
<constraintSpec ident="Check_clef_position_staffDef_nolines" scheme="schematron">
<constraint>
<sch:rule context="mei:staffDef[@clef.line and not(@lines)]">
<sch:let name="thisstaff" value="@n"/>
<sch:let name="stafflines" value="preceding::mei:staffDef[@n=$thisstaff and @lines][1]/@lines"/>
<sch:assert test="number(@clef.line) <= number($stafflines)">The clef position must be less than or equal to the number of lines on the staff.</sch:assert>
</sch:rule>
</constraint>
</constraintSpec>
<constraintSpec ident="Check_lines_color" scheme="schematron">
<constraint>
<sch:pattern>
<sch:rule context="mei:staffDef[@lines.color and @lines]">
<sch:let name="countTokens" value="count(tokenize(normalize-space(@lines.color), '\s'))"/>
<sch:assert test="$countTokens = 1 or $countTokens = @lines">The lines.color attribute must have either 1) a single value or 2) the same number of values as there are staff lines.</sch:assert>
</sch:rule>
<sch:rule context="mei:staffDef[@lines.color and not(@lines)]">
<sch:let name="countTokens" value="count(tokenize(normalize-space(@lines.color), '\s'))"/>
<sch:let name="thisstaff" value="@n"/>
<sch:assert test="$countTokens = 1 or $countTokens = preceding::mei:staffDef[@n=$thisstaff and @lines][1]/@lines">The lines.color attribute must have either 1) a single value or 2) the same number of values as there are staff lines.</sch:assert>
</sch:rule>
</sch:pattern>
</constraint>
</constraintSpec>
<constraintSpec ident="Check_staff_ppq_ancestor" scheme="schematron">
<constraint>
<sch:pattern>
<sch:rule context="mei:staffDef[@ppq][ancestor::mei:scoreDef[@ppq]]">
<sch:let name="staffPPQ" value="@ppq"/>
<sch:let name="scorePPQ" value="ancestor::mei:scoreDef[@ppq][1]/@ppq"/>
<sch:assert test="($scorePPQ mod $staffPPQ) = 0">The value of ppq must be a factor of the value of ppq on an ancestor scoreDef.</sch:assert>
</sch:rule>
</sch:pattern>
</constraint>
</constraintSpec>
<constraintSpec ident="Check_staff_ppq_preceding" scheme="schematron">
<constraint>
<sch:pattern>
<sch:rule context="mei:staffDef[@ppq][preceding::mei:scoreDef[@ppq]]">
<sch:let name="staffPPQ" value="@ppq"/>
<sch:let name="scorePPQ" value="preceding::mei:scoreDef[@ppq][1]/@ppq"/>
<sch:assert test="($scorePPQ mod $staffPPQ) = 0">The value of ppq must be a factor of the value of ppq on a preceding scoreDef.</sch:assert>
</sch:rule>
</sch:pattern>
</constraint>
</constraintSpec>
</elementSpec>