I've found a quick and dirty way to remove those empty lines. But my solution involves modifying classes from the Silverstripe core, in fact you need to modify the Controller class. Also this change was only tested on Silverstripe 2.3.3 and as of now i don't know if this hack also works in newer versions (though I guess it will work for all 2.3 versions). Also it would be much better if this change could be done to the parsed templates, as it would not require to run the replacement at every request to your website. unfortunately you can not really use the same method in SSViewer where the templates are parsed.
You need to change the file /sapphire/core/control/Controller.php
Add the following line to the variable declarations (e.g. at the top so you find easily find it if this change breaks something):
public static $remove_empty_lines = false;
Now search for the following line in the function "handleRequest":
$this->response->setBody($body);
Before this line add the following:
if(self::$remove_empty_lines) $body = preg_replace("/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+/", "\n", $body);
If you want to enable this feature add the following line to your _config.php:
Controller::$remove_empty_lines = true;
I assure you to test you're code against this change, as I haven't done a lot of testing.