A gotcha on XSLT is the default rules. A good article describing them is here: http://www.dpawson.co.uk/xsl/sect2/defaultrule.html
The short version:
#!XML <xsl:template match="*"> <xsl:apply-templates/> </xsl:template>
That way you can make a template that matches an element and you will get to it.
#!XML <xsl:template match="text()"> <xsl:value-of select="."/> </xsl:template>
Which always expands the text elements.
The first one is sensible and you should leave it. But you can change the behaviour by writing your own.
The second, text expansion can be changed in one of two ways:
Removing the text node:
#!XML <xsl:template match="text()" />