Shortened the code a bit. Ignoring empty style attribte value.