I can't see exactly where the whitespace is in the stylesheet or hte output so it's hard to be sure which is right; also you haven't given any details of how the transformation was run or what serialization parameters were used.
The xsl:attribute instruction here is quite unnecessary, you could use a literal attribute in the stylesheet:
Code:
<purpose tc="100080007">...
Generally it's probably good practice to surround literal text in the stylesheet with an xsl:text element to get better control of whitespace handling.