I guess the following can be looked at one of the potential solution -
================================================
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="*[count(descendant::text()[string-length(normalize-space(.))>0])>0]">
<xsl:choose>
<xsl:when test="count(*|text()[string-length(normalize-space(.))>0])">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:when>
<xsl
therwise/>
</xsl:choose>
</xsl:template>
<xsl:template match="text()[string-length(normalize-space(.))>0]">
<xsl:value-of select="normalize-space(.)"/>
</xsl:template>
<xsl:template match="text()"/>
</xsl:stylesheet>
=================================================
I tested it on some of the configurations as Roseanne thought of and it seems to be doing the job. One more thing is that it gives the output in normalized sort of form which doesnot have any additional carriage-returns, and empty text nodes. One more thing is that now its 12:42 A.M. and i need to go to bed