added ending[@type="discontinued"]
fixed bug for middle-of-measure repeat in first measure of selection