SharePoint XSL Conditional Formatting for custom lists

Given that users are familiar with Microsoft Office Excel applications, find it absolutely normal to use conditional formatting in SharePoint lists.

In fact, SharePoint lists are web pages that cannot be formatted as easy as in Excel. Most experts recommend three methods of formatting lists custom: JS scripts, XSL styles or acquisition of specialized applications.

Script on which I propose is based on XSL style and is customizable for both the SharePoint site of on-premises and for Office 365.

The script also contains many formatting of the default SharePoint designated to improve the end users experience, but it can make more improvements.

Custom list structure:


You have to use in XSL the internal name of columns:

If you want to identify the internal names of columns you have to use a custom XSL with the template:

<xsl:template match=”/” xmlns:x=””>

<!– Defining variable userd for all records from a Links list –>
<xsl:variable name=”Rows” select=”/dsQueryResponse/Rows/Row” />
<!– Display the list as a unsorted list. Also you can choose to create a table. –>   
    <xsl:for-each select=”$Rows”>
    <!– Extract the columns of an object. –>
            <xsl:for-each select=”@*”>
                <xsl:value-of select=”name()” /> |


If you want to test my script into a test development you can download it from the address:

Internal Names of the columns in this sample:

ID | PermMask | FSObjType | Title | FileLeafRef | FileLeafRef.Name | FileLeafRef.Suffix | Created_x0020_Date | Created_x0020_Date.ifnew | FileRef | FileRef.urlencode | FileRef.urlencodeasurl | File_x0020_Type | HTML_x0020_File_x0020_Type.File_x0020_Type.mapall | HTML_x0020_File_x0020_Type.File_x0020_Type.mapcon | HTML_x0020_File_x0020_Type.File_x0020_Type.mapico | ContentTypeId | Stock | Stock. | SS | SS. | RS |

  • ProductName = Title
  • Stock = Stock
  • Safety Stock = SS
  • Required Supply = RS – calculated column. Formula: =IF([Safety Stock]-Stock>0;[Safety Stock]-Stock;0)
    Depending your locale the formula could be different. Replace ”;” character with ”,”. Also the internal name could be different.

To proceed to the following steps, you have to be sure that you have appropiate permissions.

Test steps:

  1. Download the script from previous Link;
  2. Create a custom list in SharePoint on-premises or Office 365;
  3. Give the name of the list Stocks… or other names… is not important for this sample;
  4. Create columns with short name (eg. SS) and rename columns with a display name;
  5. Create new records, and fill the sample data to accieve condition;
  6. Create a new View and name it Formatting. Is not so important but you have to modify the XSL script if you choose to specify a different name;
  7. Customize your XSL script and uploade it on the SharePoint site in Site Assets library;
  8. Open the Formatting view from the custom list Stocks and from the Settings menu choose Edit Page option;
  9. From the Edit page choose Web part properties:
  10. Expand Miscellaneous and in text box XSL Link type: /SiteAssets/cf_Stocks.xsl
  11. Click Apply button, Ok and close Page editing.

If you want to choose another condition for you custom solution you have to modify the XSL file and to edit another condition on the line 74 from my script:


Also you can apply multiple formats using different xsl:when conditions.

Script details:




Hope it helps and thank you for future feedback!

Customizing the Links SharePoint App to open links into new window using XSL Link


This article describe a simple way to format Links App web parts using XSL Link for SharePoint Server 2013 and SharePoint Online from Office 365.


Into a Links app you can add new items by specifying URL, Description and Notes. By default all links stored in this lists are opened into the same windows/tab. This article purpose a new way to open links into another tab/windows by using a custom XSL file, without any programming skills or tools.


There are many articles on the internet that are demonstrating the use of custom applications, JavaScript or programming languages. Other articles are referring to other type of links. (see References section)

Tested in SharePoint Server 2013 and SharePoint online from Office 365.

How it works


  1. Create a default Links app (Add an app, select Links, type the name example Links and press Ok).
  2. Open site contents, Site Assets, and upload the XSL file.
  3. Copy the shortcut of uploaded xsl file into your clipboard.
  4. Edit your page and insert Links App part.
  5. Check the webpart from page and select Web part Properties from Ribbon.
  6. From the right side expand Miscellaneous and paste your clipboard into the XSL Link text box and click Apply

How to add the XSL as XSL Link for Links App

Press Ok and Save the page.

XSL File

The file could be downloaded from Technet Gallery from the address:

<?xml version=”1.0″ encoding=”UTF-8″?>
#Project: Open Links in New Tab v1
#Author: Valy Greavu, MVP
#Date: 2014-11-26
#Version comment:

<!– XLS Link SharePoint Definition –>
<xsl:stylesheet xmlns:x=””
        exclude-result-prefixes=”xsl msxsl ddwrt”

    <xsl:output method=”html” indent=”no”/>
    <xsl:template match=”/” xmlns:x=””>

    <!– Defining variable userd for all records from a Links list –>
    <xsl:variable name=”Rows” select=”/dsQueryResponse/Rows/Row” />
    <!– Display the list as a unsorted list. Also you can choose to create a table. –>   
        <xsl:for-each select=”$Rows”>
            <xsl:variable name=”LinkUrl”>
                <xsl:value-of select=”@URL”/>
            <xsl:variable name=”LinkTitle”>
                <xsl:value-of select=”@URL.desc”/>   
                <a href=”{$LinkUrl}” target=”_blank”>
                    <xsl:value-of select=”$LinkTitle” />

<!– EOF –>


Blog la