Make the whitespace stripping dependent on attributes

This allows more precise customization of when to strip or not to strip.