>I declared LotsofSpaces as below and it seems not working
<xsl:variable name="lotsOfSpaces">
<text> <text/>
</xsl:variable>
Whitespace text nodes in a stylesheet are stripped out. You want
<xsl:variable name="lotsOfSpaces" select="' ... '"/>
Also, don't do
<xsl:with-param name="x">
<xsl:value-of select="y"/>
</xsl:with-param>
XSLT doesn't have to be as verbose as that! Instead write
<xsl:with-param name="x" select="y"/>
It's a lot faster as well.
Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference