I wrote the test in Schematron, not XSLT (as it seems to me this is a
constraint on the business rules of the input document, but to each his own),
but should be pretty similar, no?
<sch:rule context="Range[following::Range]">
<!-- my maximum is either my value or, if I have a hyphen, then the
value of what comes after said hyphen -->
<sch:let name="mymax" value="(if ( contains( ., '-') ) then
substring-after( ., '-') else .) cast as xs:integer"/>
<!-- get next <Range> for texting -->
<sch:let name="next" value="following::Range[1]/string()"/>
<!-- its minimum is either its value or, if it has a hyphen, then the
value of what comes before said hyphen -->
<sch:let name="nextmin" value="( if ( contains( $next, '-') ) then
substring-before( $next, '-') else $next) cast as xs:integer"/>
<!-- in order to be consecutive, my max need be one less than the next
min -->
<sch:assert test="$mymax + 1 eq $nextmin">Range following this one is
not consecutive</sch:assert>
</sch:rule>
________________________________
|