Skip to main content

Modifying SharePoint's ItemStyle.xsl causes problem with Summary Link Web Part

Today I discovered an issue with some customisations I did for a client. The customisations involved changing the ItemStyle.xsl file, to add new templates for a Content Query Web Part.

More specifically, the client wanted to show a view of news items, the latest news item to be displayed in full, and the remaining x number of items to display in summary form.

This can be done with a test for preceding sibling nodes, e.g.

This particular client had one more specific requirement, to also show images associated to the latest News Item. To do this, I created a new XSL variable, pulling in the URL of the image with the following code:
<xsl:variable name="NewsItemImage">
<xsl:call-template name="OuterTemplate.FormatValueIntoUrl">
<xsl:with-param name="Value" select="@ImageUrl">

After some fiddling around with HTML to ensure news items would display in a pleasant manner, I checked in all changes to ItemStyle.xsl, and finished configuring the Content Query Web Part's Item style (under Modify Shared Web Part -> Presentation) to use the new style. All was good in the world.

But, a few days later after the client had begun adding content to the site, they noticed they couldn't add Summary Link Web Parts. All Summary Link Web Parts would display the old "Unable to display this Web Part. To troubleshoot the problem, open this Web page in a Windows SharePoint" error message.

After digging around in the SharePoint log files, I found that every time a page that contains a Summary Link Web Part was loaded, the following error would occur:
The named template 'OuterTemplate.FormatValueIntoUrl' does not exist. An error occurred at http://xxx/Style Library/XSL Style Sheets/ItemStyle.xsl(392,10).     at System.Xml.Xsl.XslCompiledTransform.LoadInternal(Object stylesheet, XsltSettings settings, XmlResolver stylesheetResolver)     at System.Xml.Xsl.XslCompiledTransform.Load(XmlReader stylesheet, XsltSettings settings, XmlResolver stylesheetResolver)     at Microsoft.SharePoint.WebPartPages.DataFormWebPart.GetXslCompiledTransform()

So apparently, the OuterTemplate in the of a Summary Link Web Part doesn't have the same <xsl:template>'s defined as the OuterTemplate of a Web Part that sources data from a list. This makes sense, since the links contained in a Summary Link Web Part are stored within the Web Part contents themselves, and not queried from elsewhere in the site.

The solution?

Add a dummy <xsl:template name="OuterTemplate.FormatValueIntoUrl"> element to the bottom of your ItemStyle.xsl. That way, when the Summary Link Web Part tries to validate the contents of ItemStyle.xsl, it has an <xsl:template> to refer to for "OuterTemplate.FormatValueIntoUrl", and when the Content Query Web Part parses the data through the Item Style, it refers to it's real OuterTemplate's <xsl:template> instead. Here's an example of the actual XSL code to add:
<!-- The following is used to fool the summary links web part into thinking the OuterTemplate.FormatValueIntoUrl template exists -->
<xsl:template name="OuterTemplate.FormatValueIntoUrl"></xsl:template>


  1. Thank you - this was so helpful. I had the exact same problem and you just saved me a ton of time.

    Lindy Gibbons

  2. Thanks, I too had this exact problem and am glad that someone posted it up. You saved me a lot of time and frustration.

  3. I've learned since writing this post that the best way to avoid this issue is to use your own ItemStyle.xsl and leave the default SharePoint version intact.

    Heather Solomon ( and the MSDN ( both suggest editing ItemStyle.xsl itself. This is bad in my opinion as its very dificult to back-out the change, say if your modification was deployed via a Site-level feature. If your ItemStyle XSL sits in its own file, its a lot easier to delete.

  4. I had this exact problem too. I'm just wondering if there is a way to prevent "OuterTemplate.FormatValueIntoUrl" from displaying in the 'Item style:' dropdown list within the 'Presentation' section of the sharepoint GUI?


Post a Comment

Popular posts from this blog

Thoughts, shortcomings, gotchas on SPFx Dynamic Data capabilities

It's the festive break, and I thought I'd try the new Dynamic Data capabilities that recently went to General Availability in SharePoint Framework 1.7. I've been building a lot of React components lately, and all the SPFx web parts and application customisers with visual elements we create at Engage Squared, are built on React.  Dynamic Data in SPFx introduces a whole new world of modularity that we haven't had before. We can now split up the page elements into multiple web parts that, in the past, have been combined as one web part so state can be passed between them.  Doing this gives control back to the page author, with the ability to position components how they wish. Breaking components up in to individual web parts also changes the way the components are designed, and forces the developer to leverage the responsive capabilities of modern pages.  Modern pages are designed from the ground up to work on many different screen sizes, and as long as each individual

Apps for SharePoint 2013 - Client and Server-side code

It's about time I blew the dust off this blog. Tonight I did a presentation at the Melbourne SharePoint User Group entitled Apps For SharePoint (2013). It included two demos based on the App For SharePoint 2013 solution template in Visual Studio 2012. The two demos illustrated how you can create a separate ASP.Net Web Application. Demo 1 showed how easy it is to hook in to SharePoint to obtain List properties via server-side code (populating an ASP.Net Repeater Control). Demo 2 showed what you can do with SharePoint 2013's Javascript hooks. Specifically, using SP.UI.Controls.js from the /_layouts/15/ SharePoint folder to pull chrome elements out of SharePoint, and render them in your ASP.Net web app. No animals were harmed in the making of these demos, but a few articles kindly provided on the Microsoft MSDN site helped put it together: How to: Set up an on-premises development environment for apps for SharePoint How to: Create high-trust apps for SharePoint 2013 usin

SharePoint User Profiles and Properties error

I recently encountered an issue with the Shared Services Administration page for User Profile and Properties (the page where you schedule an Active Directory profile import). The page in question is in the Shared Services Provider site, e.g. http://server:port/ssp/admin/_layouts/ProfMain.aspx The error that gets displayed is: An error has occurred while accessing the SQL Server database or the Office SharePoint Server Search service. If this is the first time you have seen this message, try again later. If this problem persists, contact your administrator. The error was odd, because I knew SharePoint Search was functioning (search crawls were running as normal, and search queries were being filled in the web front end). After a bit of investigation, I found the following table to be missing some records that were required. So in actual fact, the error being referred to when accessing the SQL Server database was that some expected records weren't in the table being looked up,