make reference-from-sgm.perl more robust
bug fix with interaction of alternate weights and xml markup