document: accumulate all the style text before parsing it
Fixes a regression introduced in the recent refactoring. While at it, improve the style type attribute parsing so that invalid values are detected during the parsing of attributes. A corresponding test case is included.