Ensured whitespace is collapsed in terms

Also added code to sort the terms before emitting
them and added a test to be sure the whitespace is
really getting removed.
Merge pull request #347 from w3c/patch-345r2

Ensured whitespace is collapsed in terms

Closes #345 again
v3.2.23
Merge branch 'develop' into gh-pages