sort attributes alphabetically and according to their order