SharePoint: How to display blog feed using XML Web Part?

I wanted to show our company’s blog feed on our intranet first page. There some empty space I wanted to fill somehow. I found a good solution, so there was no need for some third-party Web Parts. Also there was no need to write any additional code.

SharePoint XML web part propertiesHere’s my blog feed example as easy step-by-step guide.

  1. Move to SharePoint page you want to add your blog feed.
     
  2. Open this page in edit view and add new Web Part called XML Web Part.
     
  3. If Web Part is added to page then open it’s settings window.
     
  4. On the field XML Link insert your blog feed URL. Check out if link is correct and content is receivable by clicking the link titled as Test Link.
     
  5. Push button titled as [XSL Editor].
     
  6. XSL editing window is opened and now insert XSL code given below. When inserted click [OK].
     
  7. If everything is okay then you should see your blog’s last titles as bulleted list.
     
  8. If you see your blog entries in bulleted list then it is okay to save edited page.

XSL you need is here. Take it using copy and paste.

<?xml version="1.0" encoding="UTF-8"?>
<
xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    exclude-result-prefixes="xsl"
>
  <
xsl:output method="xml" omit-xml-declaration="yes" indent="yes"
/>
  <
xsl:template match="/"
>
    <
div
>
      <
xsl:apply-templates select="rss/channel"
/>
    </
div
>
  </
xsl:template
>
  <
xsl:template match="rss/channel"
>
    <
xsl:variable name="link" select="link"
/>
    <
xsl:variable name="description" select="description"/>

    <ul
>
      <
xsl:apply-templates select="item"
/>
    </
ul
>
  </
xsl:template
>
  <
xsl:template match="item"
>
    <
xsl:variable name="item_link" select="link"
/>
    <
xsl:variable name="item_title" select="description"
/>
    <
li
>
      <
a href="{$item_link}" title="{$item_title}"
>
        <
xsl:value-of select="title"
/>
      </
a
>
    </
li
>
  </
xsl:template
>
</
xsl:stylesheet
>

The result I got in my company’s intranet is here.

Blog feed output

Gunnar Peipman

Gunnar Peipman is ASP.NET, Azure and SharePoint fan, Estonian Microsoft user group leader, blogger, conference speaker, teacher, and tech maniac. Since 2008 he is Microsoft MVP specialized on ASP.NET.

    46 thoughts on “SharePoint: How to display blog feed using XML Web Part?

    • November 30, -0001 at 12:00 am
      Permalink
    • January 15, 2008 at 11:18 pm
      Permalink

      I don’t see the error message anymore but I only see a bullet and don’t see the content of the feed.

    • January 17, 2008 at 11:20 am
      Permalink

      Hi Brian!

      There are different versions of RSS and other feed formats. My example should work with RSS 2. If you need wider support for feed formats you can replace this XSL with more complete XSL that can handle many different formats.

    • January 17, 2008 at 5:06 pm
      Permalink

      Hi Gunnar,

      Thanks for your replay.

    • April 29, 2008 at 5:06 pm
      Permalink

      You should insert full URL of feed.

    • September 8, 2008 at 7:12 am
      Permalink

      Thanks for this tip. Just tried it out and it worked perfectly!

    • October 28, 2008 at 9:26 pm
      Permalink

      Great!

      I also had a problem “Webpart content expired”. This issue was resolved by adding proxy configurations to my web.config.

      Thanks for the helpful tutorial.

    • November 4, 2008 at 12:28 am
      Permalink

      I’m having a problem like Walter Parrish above. The URL to the feed doesn’t end in .xml, it’s listview.aspx?List={GUID} instead. (It’s a blog within the Sharepoint Site) When I click test link, IE7 renders the feed properly, but when I click OK in the edit shared web part box, I get the same “Cannot retrieve the URL specified in the XML Link property. For more assistance, contact your site administrator.” error message as Walter Parrish.

    • January 14, 2009 at 3:07 pm
      Permalink

      Hello,

      thanks, works fine.

      i have only one question. how can i create limit for dislpayed RSS items?

    • May 25, 2009 at 10:26 am
      Permalink

      Hi, I created the XLS webpart and copied the XSL scripts but got the error ‘Failed to apply XSLT to the content.’ Pls help. Thanks.

    • August 10, 2009 at 9:58 am
      Permalink

      Is it easy to restrict the number of entries the rss brings back? I had hoped to use it for a simple bbc news feed but it is bringing back about 30 entries which is shoving everything off the bottom of the page.

      This is a great little article by the way, so simple. Many thanks for publishing.

      Gav

    • October 7, 2009 at 11:02 am
      Permalink

      Hi

      Is it possible to change to something else than bullets in the feed ?

    • October 7, 2009 at 2:48 pm
      Permalink

      Hi Patrik!

      Yes, it is possible. You have to change the XSL transform a little bit. That’s it.

    • October 28, 2009 at 4:41 am
      Permalink

      Thanks for saying it is possible but how do you do it?

    • November 1, 2009 at 9:11 pm
      Permalink

      When I try the original XSLT on this page, I get an error saying failed to apply xslt to content. Then I tried Matt D’s xslt, and I get the error The XSL specified by the XSL property or XSL Link property is not valid, or the XSL file cannot be accessed. Make sure you have specified a valid XSL style sheet for this Web Part, or if the XSL file is linked that it can be accessed by the server. For assistance, contact your site administrator. More about making XSL files accessible

      The RSS feed in question is a twitter feed. Is there something unique about them?

    • November 17, 2009 at 4:48 pm
      Permalink

      Matt :D’s xslt to limit the number of items displayed works! Just be sure to write out the full link to http://www.w3.org.

      Thanks for this tip!

    • November 17, 2009 at 8:26 pm
      Permalink

      I’m interested in using this to display recent images from a Flickr pool in Sharepoint. I’ve got the code that Matt :D provided to work, and it looks quite good. However, I haven’t had any luck modifying it to be able to pull the url attribute from each item’s media:thumbnail.

    • January 22, 2010 at 8:43 pm
      Permalink

      Define media namespace also in your XSL file. This way XSL is able to “see” this namespace.

    • February 18, 2010 at 2:10 pm
      Permalink

      @diimortal: Can you clarify “Define media namespace also in your XSL file. This way XSL is able to “see” this namespace”? I have the same issue.

    • February 18, 2010 at 2:47 pm
      Permalink

      Hi Paul!

      If you want to use elements from namespaces that are not dfined in your XSL you must add definitions of these namespaces to your XSL file.

      If your XML contains tag like mymedia:imageurl then you have to add mymedia namespace also to your XSL file.

    • February 22, 2010 at 7:58 pm
      Permalink

      мне кажется: бесподобно. а82ч

    • February 23, 2010 at 6:01 pm
      Permalink

      Yuhoooo!!! I found this.

      Thanks a ton, you made my day.

    • March 9, 2010 at 12:46 pm
      Permalink

      Hi

      I keep getting ‘The Web Part has timed out’ message.

      Any further help would be most appreciated.

      Thanks.

    • August 23, 2010 at 10:04 pm
      Permalink

      Worked great!

      Any way to force these links to open in a new tab/page?

    • August 30, 2010 at 11:38 pm
      Permalink

      Any way to force these links to open in a new tab/page?

    • August 31, 2010 at 2:13 am
      Permalink

      Blanca, instead of

      <a href=”{$item_link}” title=”{$item_title}”>

      use

      <a href=”{$item_link}” title=”{$item_title}” target=”_blank”>

    • September 21, 2010 at 11:50 am
      Permalink

      This is an excellent post mate…

      What if I have some kind of a requirement like this…

      To display a thumbnail of each blog post with some description and have some paging capability to go through numbers and see some small part of the actual blog post.

      Any idea…

      Thanx

    • September 28, 2010 at 7:07 pm
      Permalink

      I’m having the same issue as Max.

      Anon. Access is turned on, yet I am still receiving the “Cannot retrieve the URL specified in the XML Link property. For more assistance, contact your site administrator” error message.

      Anyone have any ideas?

    • October 1, 2010 at 9:31 pm
      Permalink

      excellent. thanks.

    • November 6, 2010 at 4:22 pm
      Permalink

      Hi, I need help. Trying to create a xml blog with a menu (repeater) that shows post number and dynamically changes(datalist) based on category clicked . Any help would be appreciated. It has to be XML and I don’t want to use other bloated blog applications. Just a simple example one page.

      hm_team2003@hotmail.com

    • July 13, 2011 at 1:04 pm
      Permalink

      Great – works a treat

    • September 14, 2011 at 3:53 pm
      Permalink

      works great : thanx a lot

    • September 21, 2011 at 3:52 pm
      Permalink

      How do I gett letters like Č,Š, Ž inside.

      it is windows-1250 tabels.

    • September 22, 2011 at 12:28 am
      Permalink

      asiest way without coding something should be using XML with different character set. Other option is to download XML to server, make conversions and then produce output.

    • October 18, 2011 at 3:50 pm
      Permalink

      I am getting an error “Failed to apply XSLT to the content.”

      Test link is working fine.

      Any Idea?

    • November 3, 2011 at 3:29 pm
      Permalink

      HEy, this is a great tool! But i’m getting “Failed to apply XSLT to the content.” Could you help me?

    • November 5, 2011 at 1:28 pm
      Permalink

      Issue Solve :

      “Cannot retrieve the URL specified in the XML Link property. For more assistance, contact your site administrator” error message.

      Ans:When You Test Link, Default it take Https:// Redirect Your URL With Http://

    • September 15, 2011 at 1:54 pm
      Permalink

      how do i consume my blog’s rss feeds in my asp.net site..

    • Pingback:Show your Twitter log in SharePoint | Gunnar Peipman - Programming Blog

    • March 26, 2015 at 11:42 am
      Permalink

      Hi, Does this work for Sharepoint 2013?My SP Blog RS Feed is listed as https://something/Blog/listfeed.aspx?List={1CC1AFDB-FD97-428B-9B65-43FB8A713BBA}

      which causes a ” Cannot retrieve the URL specified in the XML Link property. For more assistance, contact your site administrator ”

      Anyone have a solution PLEASE

    Leave a Reply

    Your email address will not be published. Required fields are marked *