In case your XML elements contain multiple whitespaces within the text, or leading and trailing the text, you could use normalize-space() function to remove the leading and trailing whitespaces, as well as to combine all adjacent intermediary whitespaces into one single whitespace.
For e.g
Input
<input> 1sp 2sp 3sp 4sp 5sp 3sp end</input>
XSLT
<ns1:result>
<xsl:value-of select="normalize-space(/input)"/>
</ns1:result>
Result
<result>1sp 2sp 3sp 4sp 5sp 3sp end</result>