Highlight List Entries Based on Date Criteria

Technologies: SharePoint 2007-Online; SharePoint Designer 2010-2013; XSL

Purpose: Provide a means to highlight specific entries based on date parameters. Use highlights of yellow, orange and red; otherwise, display the content with a normal font color. This solution is best implemented for those conditions that are more complex than what can be handled with calculated columns.

Create an .ASPX page and include a custom Data View Web Part displaying a few columns from your favorite list.

A sample of XSL using a Choose / When statement to compare dates is shown below.

<td class=”ms-vb”>
<xsl:when test=”ddwrt:DateTimeTick(ddwrt:GenDisplayName(string(ddwrt:Today())))  &gt;= ddwrt:DateTimeTick(ddwrt:GenDisplayName(string(@DestructionDate)))”>
<xsl:attribute name=”style”>
background-color: #FF0000;  <!– Red    //–>
<xsl:attribute name=”style”>
font-weight: normal;
<xsl:value-of select=”@DestructionDate”/>


This entry was posted in Data View Web Part, SharePoint Designer, Web Parts, XSL. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s