The problem isn't with XML or with your XSLT, it is with HTML. In HTML, multiple whitespace characters are considered equivalent to a single space and are displayed as such by the browser. The simplest way out of this is to wrap the output in a <pre> element.
Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference