Perhaps you are using Microsoft's XSLT processor, which contrary to the XSLT specification removes white-space-only text nodes: this means that your <name> </name> becomes <name></name>.
Try testing xsl:if test="normalize-space(name)".
Also, if the entire body of a for-each consists of an xsl:if, then you can put the condition into the select expression as a predicate:
xsl:for-each select="/a/b/c/d[normalize-space(name)]">
Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference