XSLT错误"找不到与命名空间关联的脚本或扩展对象' http://schemas.microsoft.com/WebParts/v2/DataView/runtime'"

时间:2014-12-31 19:16:50

标签: xml xslt sharepoint

我在我的SP2013应用中遇到错误,因为它找不到明确定义的架构。我错误地定义了这个吗?有人可以阐明它应该如何定义?我正在将Sharepoint的OOTB XSLT用于RSS视图webpart。这是XSLT:

<xsl:stylesheet xmlns:x="http://www.w3.org/2001/XMLSchema"
           version="1.0" exclude-result-prefixes="xsl ddwrt msxsl rssaggwrt"
           xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime"
           xmlns:rssaggwrt="http://schemas.microsoft.com/WebParts/v3/rssagg/runtime"
           xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt"
           xmlns:rssFeed="urn:schemas-microsoft-com:sharepoint:RSSAggregatorWebPart"
           xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
           xmlns:dc="http://purl.org/dc/elements/1.1/"
           xmlns:rss1="http://purl.org/rss/1.0/" xmlns:atom="http://www.w3.org/2005/Atom"
           xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"
           xmlns:atom2="http://purl.org/atom/ns#">

  <xsl:param name="rss_FeedLimit">5</xsl:param>
  <xsl:param name="rss_ExpandFeed">false</xsl:param>
  <xsl:param name="rss_LCID">1033</xsl:param>
  <xsl:param name="rss_WebPartID">RSS_Viewer_WebPart</xsl:param>
  <xsl:param name="rss_alignValue">left</xsl:param>
  <xsl:param name="rss_IsDesignMode">True</xsl:param>

  <xsl:template match="rss">
    <xsl:call-template name="RSSMainTemplate"/>
  </xsl:template>

  <xsl:template name="RSSMainTemplate" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt">
    <xsl:variable name="Rows" select="channel/item"/>
    <xsl:variable name="RowCount" select="count($Rows)"/>
    <div class="slm-layout-main" >
      <xsl:call-template name="RSSMainTemplate.body">
        <xsl:with-param name="Rows" select="$Rows"/>
        <xsl:with-param name="RowCount" select="count($Rows)"/>
      </xsl:call-template>
    </div>
  </xsl:template>

  <xsl:template name="RSSMainTemplate.body" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt">
    <xsl:param name="Rows"/>
    <xsl:param name="RowCount"/>
    <xsl:for-each select="$Rows">
      <xsl:variable name="CurPosition" select="position()" />
      <xsl:variable name="RssFeedLink" select="$rss_WebPartID" />
      <xsl:variable name="CurrentElement" select="concat($RssFeedLink,$CurPosition)" />
      <xsl:if test="($CurPosition &lt;= $rss_FeedLimit)">
        <div class="item link-item" >
          <a class="title rss-title" href="{(string(link))}" >
            <xsl:value-of select="title"/>
          </a>

          <xsl:if test="$rss_ExpandFeed = true()">
            <xsl:call-template name="RSSMainTemplate.description">
              <xsl:with-param name="DescriptionStyle" select="string('display:block;')"/>
              <xsl:with-param name="CurrentElement" select="$CurrentElement"/>
            </xsl:call-template>
          </xsl:if>
          <xsl:if test="$rss_ExpandFeed = false()">
            <xsl:call-template name="RSSMainTemplate.description">
              <xsl:with-param name="DescriptionStyle" select="string('display:none;')"/>
              <xsl:with-param name="CurrentElement" select="$CurrentElement"/>
            </xsl:call-template>
          </xsl:if>
        </div>
      </xsl:if>
    </xsl:for-each>
  </xsl:template>

  <xsl:template name="RSSMainTemplate.description" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt">
    <xsl:param name="DescriptionStyle"/>
    <xsl:param name="CurrentElement"/>
    <div id="{$CurrentElement}" class="description" align="{$rss_alignValue}" style="{$DescriptionStyle} text-align:{$rss_alignValue};">
      <div class="rss-date date">
        <xsl:choose>
          <xsl:when test="string-length(pubDate) > 0">
            <xsl:variable name="pubDateLength" select="string-length(pubDate) - 3" />
            <xsl:value-of select="ddwrt:FormatDate(pubDate,number($rss_LCID),3)"/>
          </xsl:when>
          <xsl:otherwise>
            <xsl:value-of select="ddwrt:FormatDate(pubDate,number($rss_LCID),3)"/>
          </xsl:otherwise>
        </xsl:choose>
      </div>
      <xsl:if test="string-length(description) > 0">
        <xsl:variable name="SafeHtml">
          <xsl:call-template name="GetSafeHtml">
            <xsl:with-param name="Html" select="description"/>
          </xsl:call-template>
        </xsl:variable>
        - <xsl:value-of select="$SafeHtml" disable-output-escaping="yes"/>
      </xsl:if>
      <div class="description">
        <a href="{ddwrt:EnsureAllowedProtocol(string(link))}">More...</a>
      </div>
    </div>
  </xsl:template>

  <xsl:template name="GetSafeHtml">
    <xsl:param name="Html"/>
    <xsl:choose>
      <xsl:when test="$rss_IsDesignMode = 'True'">
        <xsl:value-of select="$Html"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="rssaggwrt:MakeSafe($Html)"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

</xsl:stylesheet>

反对这一输入:

<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
    <title>Associates Update</title>
    <link>
    https://square.com/
    </link>
    <description> </description>
    <language>en-us</language>
    <pubDate>Mon, 22 December 2014 15:00:00 +0900</pubDate>
    <lastBuildDate>Mon, 22 December 2014 15:00:00 +0900</lastBuildDate>
    <docs>http://blogs.abc.edu/tech/rss/</docs>
<item>
      <title>Challenge to F1: New episodes of Understanding F1 has been released.</title>
      <link>
      https://square.com/content/index/f1/understanding.html
      </link>
      <description></description>
      <category>Challenge to F1</category>
      <pubDate>Mon, 22 December 2014 15:00:00 +0900</pubDate>
</item>
</channel>
</rss>

当我在Visual Studio中调试时,我发现XMLTransformException未被用户代码处理。

0 个答案:

没有答案