Unwanted whitespace in your result document can come from three sources:
(a) there was whitespace in the source document which you copied to the result
(b) there was whitespace in the stylesheet which you copied to the result
(c) the whitespace was added by the serializer when indenting the result document if you specified indent=yes (which is the default for HTML)
Without more information it's impossible to tell which of these was the cause in your case.
Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference