Address comments/suggestions from Asmus Freytag

This is a new attempt (previous attempt: #9) at merging our parallel work, and replaying Asmus' updates onto it.

I have made an effort to keep your formatting style and decisions you made, and tried to produce a minimal patch.

While reviewing the changes you merged, I noticed that you left out many of the comments. I suppose the reason behind that is to reduce verbosity. However, I believe that some of those comments are actually valuable, and ends up as RelaxNG annotations/documentation in the XML flavour. In particular, many of the them clarify the usage of the elements and attributes where we made a decision to not express some restrictions as actual RelaxNG rules (to keep them simple.) As such, I would like to propose that we keep them. Even if we decide to remove them for the sake of compactness, at least they're available in the repository history.

Thanks.