I normally use "whitespace" to mean x9, xA, xD, and x20, and "space" to mean just x20, so I first have to understand what you mean by the terms...
From your rules, I can't see why the space was left in "Engl ish" as in
<name>Engl ish</name>Language<name> variables</name>
Looks to me something like this (this is 2.0):
(a) an identity template
<xsl:template match="*" mode="#all">
<xsl:copy><xsl:apply-templates mode="#current"/></xsl:copy>
</xsl:template>
(b) A rule for the cases where you want to strip all spaces:
<xsl:template match="book[topic='programming']">
<xsl:copy><xsl:apply-templates mode="strip-all"/></xsl:copy>
</xsl:template>
<xsl:template match="text()" mode="strip-all">
<xsl:value-of select="translate(., ' ', '')"/>
</xsl:template>
(c) A rule for the cases where you want to strip some spaces:
<xsl:template match="book[topic='Literature']">
<xsl:copy><xsl:apply-templates mode="strip-some"/></xsl:copy>
</xsl:template>
<xsl:template match="text()[not(starts-with(preceding::text()[1], 'Lang')" mode="strip-some">
<xsl:value-of select="translate(., ' ', '')"/>
</xsl:template>
With 1.0, the only difference is that rule 1 needs to be written three times, once for each mode.
Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference