Gunnar Peipman's ASP.NET blog

ASP.NET, C#, SharePoint, SQL Server and general software development topics.

Sponsors

News

 
 
 
 
 
Programming Blogs - Blog Catalog Blog Directory

Links

Social

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.

Here's my blog feed example as easy step-by-step guide.

  1. SharePoint: XML Web Part settingsMove 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.

Posted: Jan 02 2008, 06:09 PM by DigiMortal | with 24 comment(s)
Filed under:

Comments

Brian said:

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

# January 16, 2008 5:18 PM

DigiMortal said:

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 5:20 AM

Brian said:

Hi Gunnar,

Thanks for your replay.

# January 17, 2008 11:06 AM

Creating RSS Feed Web Parts for WSS 3.0 « The WorkerThread Blog said:

Pingback from  Creating RSS Feed Web Parts for WSS 3.0 &laquo; The WorkerThread Blog

# February 11, 2008 11:20 AM

SharePoint: How to display blog feed using XML Web Part? - PeteStilgoe.com said:

Pingback from  SharePoint: How to display blog feed using XML Web Part? - PeteStilgoe.com

# March 11, 2008 8:24 AM

Walter Parrish said:

When I enter feeds.feedburner.com/gunnarpeipman?format=xml">feeds.feedburner.com/gunnarpeipman or feeds.feedburner.com/gunnarpeipman I receive the following error.

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

Any ideas?

# April 29, 2008 2:13 PM

DigiMortal said:

You should insert full URL of feed.

# April 29, 2008 4:46 PM

Irene said:

Thanks. helped me out alot.

www.portabledisplaysystems.com

# July 1, 2008 5:36 PM

Chris said:

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

# September 8, 2008 1:12 AM

Vinicius Paluch said:

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.

# October 28, 2008 3:26 PM

Mark said:

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.

# November 3, 2008 6:28 PM

Mark said:

I figured it out, it's a security issue and has to do with Anonymous Access. I wrote it up and linked it to my name here in the comments, because I got info for 3 or 4 other websites and linked to them all in the post.

You need to have Anonymous Access enabled for the whole site where the blog is located. Libraries & Lists gave a different error (blank box).

Anonymous access first has to be enabled in Central Site Admin, and then managed for each site, unless you have inherit turned on for all of them. You can set your main site (root site?) to allow anonymous access to: nothing and then change just the child site where the blog is to "entire site" and that made it work.

Link: www.docjelly.com/.../PermaLink,guid,3bdcdd7d-4870-4e8d-bb58-75da62a5cf23.aspx

Cheers and thanks Gunnar for pointing the way!

-M

# November 6, 2008 11:44 AM

Matt Moore said:

Thanks, it worked!

# November 6, 2008 7:07 PM

David said:

Hello,

thanks, works fine.

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

# January 14, 2009 9:07 AM

DigiMortal said:

To create a limit you need some xsl hacking here. Take look at <a href="incrementaldevelopment.com/.../">Parvez's Wing of the Gallery of Stupid XSL and XSLT Tricks</a>, this page may help you limiting count of items shown.

# January 19, 2009 4:33 PM

arhiderrr said:

Nice article

# February 28, 2009 1:20 PM

arhiderrr said:

Nice article

# February 28, 2009 10:14 PM

arhiderrr said:

Nice article

# March 1, 2009 6:02 AM

ioffersearch001 said:

Hii Frend

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.

<a href="http://ioffersearch.com">Ioffersearch.com Blogs - Just another Ioffersearch.com weblog</a>

Thanks

# March 5, 2009 8:43 PM

ioffersearch001 said:

Hiii

Thanks for this tip. Just tried it out and it worked perfectly! Nice instruction!,.. There are different versions of RSS and other feed formats Very Nice!,..

<a href="http://ioffersearch.com">Ioffersearch.com Blogs - Just another Ioffersearch.com weblog</a>

Thanks!...

# March 7, 2009 9:01 AM

dimcho tsanov said:

nice artical , thanks

# March 30, 2009 7:29 AM

Singh said:

Hello friends,

   I tried to add the xml webpart in wss 3.0 and added the feed url as "rss.nyalert.gov/.../NYSRSS.xml " and also added the xslt as described above.The error iam getting is ""Cannot retrieve the URL specified in the XML Link property. For more assistance, contact your site administrator"".Can anybosy tell me the reason please?? Any help really appreciated....Thanks...

# April 17, 2009 11:28 AM

Sherry said:

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.

# May 25, 2009 4:26 AM

Stewart said:

Thanks much,

A big help.

Stewart

www.netrackservers.com

# June 16, 2009 4:02 PM
Leave a Comment

(required) 

(required) 

(optional)

(required)