Refactored the style parser

The style parser is now based on the already existing domdocument &
xPath objects rather than searching through an error-prone php array.