XSL test for NULL

​I had problems trying to test for NOT NULL so I can choose one value or another depending on whether something is NULL.


Show the value of Date1. But if Date1 is NULL, show the value of Date2. If both exist, show Date1 of course.

NULL is found in SharePoint XSL by testing for an empty value, which is simply referenced as two single quotes with nothing in between. test


<xsl:when test="@Date1=''"><xsl:value-of select="ddwrt:FormatDate(string(@Date2), 1033, 5)"></xsl:when>

<xsl:otherwise>"><xsl:value-of select="ddwrt:FormatDate(string(@Date1), 1033, 5)"></xsl:otherwise>


So here you see if the value of Date1 is null, show Date2, else show Date1.


Popular posts from this blog

SharePoint Designer 2013 Approval Workflow with Comments

Change SharePoint server hostname and Web Application Names

SharePoint Search - Content Processing Pipeline Failed to Process the Item