【问题标题】:Edit XSL for SharePoint 2010 Rss Feed WebPart为 SharePoint 2010 Rss 源 WebPart 编辑 XSL
【发布时间】:2011-08-16 23:43:18
【问题描述】:

您好,

我不是 XSL/XSLT/XML 鲨鱼,虽然我曾与一些人合作过,但我从未接触过 SharePoint 2010 中的 rss 提要 webpart xsl,并且对它的工作原理知之甚少。

我想要实现的是,当 web 部件加载提要时,我希望显示标题,包括新闻提要的日期和来源。提供了所有 3 个字段,包括描述等。

我知道 SharePoint 的 Rss 提要 webpart 为此提供了 XSL,但它并没有按照我想要的方式显示它。那么我要问的是如何在 webpart 中自定义 rss 提要的显示?

非常感谢任何可以告诉我它是如何工作的指南或类似内容。

提前致谢!

【问题讨论】:

    标签: xml sharepoint sharepoint-2010 web-parts xslt


    【解决方案1】:

    您可以很好地使用 RSS webpart:首先编辑 webpart 并查找 XSL 编辑器按钮

    在 chrome 中将没有按钮,但您将在此处有一个编辑框。然后撕掉他们在那里的废话,用你自己的 xsl 代替。为了您的启迪,我包含了这个非常简单的 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>
    

    【讨论】:

      【解决方案2】:

      您将希望使用数据视图 Web 部件而不是 RSS 源 Web 部件。使用 dataview wepart,您可以将其指向外部 RSS 提要并根据您的选择设置样式。

      这是一组连接到 REST 数据源的说明。 http://hamishking.wordpress.com/tag/cross-site-collection-lookup/

      REST url 将是 RSS 文件的 url,然后在页面上,您可以使用自定义 XSL 对其进行样式设置。

      【讨论】:

        猜你喜欢
        • 2018-03-26
        • 1970-01-01
        • 2021-01-20
        • 1970-01-01
        • 2011-11-01
        • 1970-01-01
        • 2011-03-26
        • 2011-03-29
        • 2011-07-31
        相关资源
        最近更新 更多