<sch:rule context="mei:*[@place eq 'between']">
<sch:assert test="count(tokenize(normalize-space(string(@staff)), '\s+')) = 2">The @staff
attribute must contain 2 numerically-adjacent integer values.</sch:assert>
<sch:let name="tokenizedStaff" value="tokenize(normalize-space(string(@staff)), '\s+')"/>
<sch:let name="maxValue" value="max((number($tokenizedStaff[1]), number($tokenizedStaff[2])))"/>
<sch:let name="minValue" value="min((number($tokenizedStaff[1]), number($tokenizedStaff[2])))"/>
<sch:assert test="$maxValue - $minValue = 1">Staves
<sch:value-of select="$minValue"/> and
<sch:value-of select="$maxValue"/> are not adjacent.</sch:assert>
</sch:rule>
<macroSpec ident="data.STAFFREL" module="MEI" type="dt">
<desc>Location of musical material relative to a staff.</desc>
<content>
<rng:choice>
<rng:ref
name="data.STAFFREL.basic"
/>
<rng:ref
name="data.STAFFREL.extended"
/>
</rng:choice>
</content>
<constraintSpec ident="between_requires_adjacent_staves" scheme="isoschematron">
<constraint>
<sch:rule context="mei:*[@place eq 'between']">
<sch:assert test="count(tokenize(normalize-space(string(@staff)), '\s+')) = 2">The @staff
attribute must contain 2 numerically-adjacent integer values.</sch:assert>
<sch:let name="tokenizedStaff" value="tokenize(normalize-space(string(@staff)), '\s+')"/>
<sch:let name="maxValue" value="max((number($tokenizedStaff[1]), number($tokenizedStaff[2])))"/>
<sch:let name="minValue" value="min((number($tokenizedStaff[1]), number($tokenizedStaff[2])))"/>
<sch:assert test="$maxValue - $minValue = 1">Staves
<sch:value-of select="$minValue"/> and
<sch:value-of select="$maxValue"/> are not adjacent.</sch:assert>
</sch:rule>
</constraint>
</constraintSpec>
</macroSpec>