Fix #37: Preserve order of attributes on serialization.

This doesn't do anything about the fact that none of our
treebuilders preserve attribute order: it merely avoids the
serializer reordering them from the order it receives them in.

This also provides a filter to obtain the previous behaviour of
lexicographical ordering, used by the serializer tests to ensure
determinism of the output.