开发者

Edit XSL for SharePoint 2010 Rss Feed WebPart

Greetings,

I'm no XSL/XSLT/XML shark, I have worked with some, though, but I've never touched the rss feed webpart xsl in SharePoint 2010 and have very little knowledge to how it works.

What I am trying to achieve is that when the webpart loads a feed I want the Title to come out, including the Date and the Source of the news feed. All 3 fields are provided, including Description etc.

I know tha开发者_运维技巧t SharePoint's Rss Feed webpart provides XSL to this, but it doesn't display it how I want it to. So what I ask is how do I customize a display for the rss feeds in the webpart?

Any guides or similar which can tell me how it works is very much appreciated.

Thanks in advance!


You can use the RSS webpart just fine: First edit the webpart and look for the XSL editor button

Edit XSL for SharePoint 2010 Rss Feed WebPart

Edit XSL for SharePoint 2010 Rss Feed WebPart

In chrome there will be no button but you will have an edit box here. Then rip out that nonsense they have in there replace with your own xsl. For your edification I include this very simple xsl:

<?xml version="1.0" encoding="iso-8859-1"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="/">
<html>
  <head>
    <title>What's going on around here</title>
  </head>
  <body>
    <div id="explanation">
      <h3>News Around here</h3>
      <p>Allowing you to stay up to date with the latest news and features from here.</p>
    </div>
    <div id="subscribe"></div>
    <div id="content">
      <xsl:variable name="count" select="4"/>
      <xsl:for-each select="rss/channel/item">
          <xsl:variable name="myURL" select="link"/>
              <div class="article" >

                <a href="{$myURL}" rel="bookmark"> 
                  <xsl:value-of select="title"/>
                </a>
              </div>
      </xsl:for-each>
    </div>
  </body>
</html>


You will want to use the Data View Web Part instead of the RSS Feed Webpart. With the dataview wepart you can point it to an external RSS feed and style it anyway you choose.

Here is a set of instructions for connecting to a REST datasource. http://hamishking.wordpress.com/tag/cross-site-collection-lookup/

The REST url will be the url of the RSS file, and after that is on the page, you can style it with your custom XSL.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜