Your code is saying "if any of the data elements is equal to "" then apply-templates to all the data elements".
Just replace
<xsl:for-each select="ch1">
<xsl:if test="data= '' ">
<xsl:apply-templates select="data"/>
</xsl:if>
</xsl:for-each>
with
<xsl:apply-templates select="ch1/data[string(.)]"/>
Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference