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}”/>


Accordion style left navigation (quick launch) using pure CSS

<style type=”text/css”>
.s4-ql li.static
height: 2em;
overflow: hidden;

.s4-ql li.static:hover
height: auto;

.s4-ql li >
cursor: pointer;
/* Format the headers */
.s4-ql li >
cursor: pointer;
background: #0171C6;
color: white;
border: solid #fff;
border-width: 1px 0;
/* Format the accordion list items */
color: #000;
background: #C9D4FF;
border: 1px solid #97C8F7;
border-bottom: none;
/* Format the header hover, list item hover and currently selected item */
.s4-ql li >, /*Header */
.s4-ql a.selected, /* Selected */
.s4-ql /* List item */
color: #FFF;
background: #073D7D;

.s4-ql ul.root > li.static
max-height: 2em;
overflow: hidden;
transition: max-height 1s linear;

.s4-ql ul.root > li.static:hover
max-height: 500px;


Create dynamic Fusion charts from SharePoint lists

Insert an empty DVWP then select the source list and add required columns, then edit the XSLT. Look for dvt_1.body tag and replace the contents in it with the below code.

Note: You need to upload the Fusion charts in any library first, before referencing the charts

<xsl:template name=”dvt_1.body”>

<xsl:param name=”Rows”/>

#This is what you need to insert

<xsl:variable name=”varColorString” select=”‘XXXXXXAFD8F8F6BD0F8BBA00FF8E46008E8ED646468E468E588526B3AA00008ED69D080DA186BE'” />
<xsl:variable name=”varChartValue”>
<xsl:for-each select=”$Rows[not(preceding-sibling::Row/@Status = @Status ) and @Status!=”]”>
<xsl:sort select=”@Status”/>
<xsl:variable name=”varTemp” select=”@Status”/>

&lt;set name=&apos;<xsl:value-of select=”(@Status)”/>&apos; value=&apos;<xsl:value-of select=” count($Rows[@Status = $varTemp])”/>&apos; /&gt;
<xsl:variable name=”varChartData”>
&lt;graph caption=&apos;Open risks &apos; xAxisName=&apos;Project Name&apos; yAxisName=&apos;Count&apos; showNames=&apos;1&apos; decimalPrecision=&apos;0&apos; formatNumberScale=&apos;0&apos; pieYScale=&apos;45&apos; pieRadius=&apos;70&apos; animation=&apos;1&apos; shadowXShift=&apos;4&apos; shadowYShift=&apos;4&apos; shadowAlpha=&apos;40&apos; pieFillAlpha=&apos;95&apos; &gt;
<xsl:value-of select=”$varChartValue” />



#End here


Site Offline Custom Page

To create a site offline page, save the below code as html [app_offline.htm] and place it in ISS directory of web application. Just remove the file to resume the web application.

<html xmlns=””&gt;
<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ />
<title>Site Under Maintenance</title>


Note: The custom image must be uploaded at different location other than the target (web application)

Check in all the files which have no checked in version history

Save and run the below code as PowerShel script

$site = New-Object Microsoft.SharePoint.SPSite(“http://contoso/sites/teamsite”)

$root = $site.allwebs[0]

$folder = $root.GetFolder(“test2”)


# Function Set-CheckInFolderItems is a recursive function

# that will CheckIn all items in a list recursively

# You must take ownership of files using farm account prior to running this script


function Set-CheckInFolderItems([Microsoft.SharePoint.SPFolder]$folder)


# Create query object

$query = New-Object Microsoft.SharePoint.SPQuery

$query.Folder = $folder

# Get SPWeb object

$web = $folder.ParentWeb

# Get SPList

$list = $web.Lists[$folder.ParentListId]

# Get a collection of items in the specified $folder

$itemCollection = $list.GetItems($query)

# If the folder is the root of the list, display information

if ($folder.ParentListID -ne $folder.ParentFolder.ParentListID)


Write-Host(“Recursively checking in all files in ” + $folder.Name)


# Iterate through each item in the $folder

foreach ($item in $itemCollection)


# If the item is a folder

if ($item.Folder -ne $null)


# Write the Subfolder information

Write-Host(“Folder: ” + $item.Name + ” Parent Folder: ” + $folder.Name)

# Call the Get-Items function recursively for the found sub-solder

Set-CheckInFolderItems $item.Folder


# If the item is not a folder

if ($item.Folder -eq $null)


if ($item.File.CheckOutType -ne “None”)


if ($item.File.Versions.Count -eq 0)


# Check in the file

Write-Output “Check in File: “$item.Name” Version count ” $item.File.Versions.Count -foregroundcolor Green

$item.File.CheckIn(“Checked in By Administrator”)






$web = $null


Set-CheckInFolderItems $folder | Ft -autosize |Out-string -width 4096 >>C:\output.txt