Replacing text in columns with icons/images using XSL

Edit the webpart in SharePoint designer and place the below code in between <XSL></XSL> tags of the list.

<xsl:stylesheet xmlns:x=”; xmlns:d=”; version=”1.0″ exclude-result-prefixes=”xsl msxsl ddwrt” xmlns:ddwrt=”; xmlns:asp=”; xmlns:__designer=”; xmlns:xsl=”; xmlns:msxsl=”urn:schemas-microsoft-com:xslt” xmlns:SharePoint=”Microsoft.SharePoint.WebControls” xmlns:ddwrt2=”urn:frontpage:internal” xmlns:o=”urn:schemas-microsoft-com:office:office”>
<xsl:include href=”/sites/contoso/_layouts/xsl/main.xsl”/>
<xsl:include href=”/sites/contoso/_layouts/xsl/internal.xsl”/>

<xsl:template name=”FieldRef_body.Status” match=”FieldRef[@Name=’Status’]” mode=”body”>
<xsl:param name=”thisNode” select=”.”/>
<xsl:when test=”$thisNode/@*[name()=current()/@Name] = ‘Completed'”>
<img src=”/sites/contoso/Style Library/Images/1″ alt=”Status: {$thisNode/@Status}”/>
<xsl:when test=”$thisNode/@*[name()=current()/@Name] = ‘In Progress'”>
<img src=”/sites/contoso/Style Library/Images/2″ alt=”Status: {$thisNode/@Status}”/>
<img src=”/sites/contoso/Style Library/Images/3″ alt=”Status: {$thisNode/@Status}”/>



Leave a Reply

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

You are commenting using your 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 )

Google+ photo

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

Connecting to %s