Fix #581, seperate shall_write logic and style attr loop when writing xml node.
This fix allows style attributes such as font-size to be changed. This has cropped up in the text handling because most of the code moves styles to the css/style attribute and doesn't keep them as xml attrs.