How to check if String is Null or Empty in XSL

To check if String is Null or Empty in XSL you can use the following snippet.

Sample XSL

<xsl:choose>
    <xsl:when test="fieldToTest != ''">
        <xsl:value-of select="Field1Value" />
    </xsl:when>
    <xsl:otherwise>
        <xsl:value-of select="Field2Value" />
    </xsl:otherwise>
</xsl:choose>

Please Share us:
Please rate this snippet

3 thoughts on “How to check if String is Null or Empty in XSL

Leave a Reply