Set namespaces of attributes correctly

Also added tests for them.