don't print empty attr value; add a space for self-end tags