In XML, it doesn't matter what order the attributes are in. If you have some piece of XML processing code where it does matter, then I would suggest that code was buggy.
From the XML spec here, note the phrase: "Note that the order of attribute specifications in a start-tag or empty-element tag is not significant".
In answer to your specific question on whether you can enforce a certain order, I don't believe so. I've never actually tried to do it (since it's unnecessary) but it seems unlikely the REXML people would waste time implementing such a non-feature :-). Since the key/value pairs are stored as a hash, their order is likely to be random (as far as you could tell from the alphabetic sequence of the keys).
Of course, since Ruby comes with the source code for REXML, you could (if desperate) replace or augment the included copy with your own version (REXML2 ?).
Since you're doing a simple puts, it's probably using the pretty formatter so check the start of the write_element
code in src/rexml/formatters/pretty.rb
where it performs the "node.attributes.each_attribute do |attr|
" - you may find it's as simple as sorting that list before processing the elements.
You may also want to suggest to the developers (see here for the mailing list or here for bug reports and enhancement requests) that they make this an option in a future release but, if I were them, I'd simply say it was unnecessary.