I prefer to use the not function
not() Function — Returns the negation of its argument. If the argument is not a boolean value already, it is converted to a boolean value using the rules described in the boolean() function entry.
Example:
To demonstrate the not() function, we’ll use the same stylesheet and XML document we used for the boolean() function.
<xsl:choose>
<xsl:when test="not(year='')">
<xsl:value-of select="year"/>
</xsl:when>
<xsl:otherwise>
<xsl:text>The element year is NULL</xsl:text>
<xsl:otherwise>
</xsl:choose>
Same for the if statement:
<xsl:if test="not(year='')">
<xsl:value-of select="year"/>
</xsl:if>
<xsl:if test="year=''">
<xsl:text>The element year is NULL</xsl:text>
</xsl:if>