【问题标题】:SharePoint XSLT $AllRows Iteration Behaving Unexpectedly On Live SharePoint SiteSharePoint XSLT $AllRows 迭代在实时 SharePoint 网站上表现异常
【发布时间】:2011-05-21 06:03:39
【问题描述】:

我是 XSLT 的新手,我也是 Sharepoint 的新手。

我已修改我的 XLV Web 部件,使其具有以下 xml:

<xsl>
 <xsl:stylesheet xmlns:x="http://www.w3.org/2001/XMLSchema" xmlns:d="http://schemas.microsoft.com/sharepoint/dsp" version="1.0" exclude-result-prefixes="xsl msxsl ddwrt" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" xmlns:asp="http://schemas.microsoft.com/ASPNET/20" xmlns:__designer="http://schemas.microsoft.com/WebParts/v2/DataView/designer" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:SharePoint="Microsoft.SharePoint.WebControls" xmlns:ddwrt2="urn:frontpage:internal" xmlns:o="urn:schemas-microsoft-com:office:office"> 
  <xsl:include href="/_layouts/xsl/main.xsl"/> 
  <xsl:param name="AllRows" select="/dsQueryResponse/Rows/Row[$EntityName = '' or (position() &gt;= $FirstRow and position() &lt;= $LastRow)]"/>
  <xsl:param name="dvt_apos">'</xsl:param>
  <xsl:template match="View[@BaseViewID='0']" mode="full" ddwrt:ghost="always">        
   <div class="box whatsnew">
    <div class="boxcontent">
     <h2><xsl:value-of select="List/@title" /></h2>
     <p><xsl:value-of select="List/@description" /></p>

     <ul>
      <xsl:for-each select="$AllRows">      
       <li>
        <em><xsl:value-of select="@Date" /></em><br />
        <a href="{@Link}"><xsl:value-of select="@Text" /></a>
       </li>
      </xsl:for-each>
     </ul>
    </div>
   </div>
  </xsl:template>
 </xsl:stylesheet>
</xsl>

当我在 SharePoint 设计器中以设计模式查看我的 WebPart 时,列表项会按照我的预期填充。

但是当我将更改发布到 SharePoint 网站时,其中三个值返回为空白。这些值是 for-each 语句中的值:@Date、@Text 和 @Link。

我一直在寻找答案。无济于事。关于为什么此代码在我的实时 Sharepoint 网站上不起作用的任何想法?任何见解将不胜感激!

【问题讨论】:

  • 你能给我们一个输入 XML 和输出的样本吗?这样我们就不必询问您是否获得了 &lt;h2&gt; 元素,以及每个输入行的 &lt;li&gt; 等等。

标签: xml sharepoint web-parts xslt


【解决方案1】:

它们是您声明 AllRows 变量的问题。似乎它得到了空行。

请检查过滤器语句的条件部分,它看起来像概率区域。我建议首先删除条件部分并检查数据是否已完全检索。然后修改你的过滤语句

【讨论】:

    【解决方案2】:

    在我的情况下,这是 SPD 错误,当代码更改未应用于页面,但显示在 SPD 中时。下一步操作已解决此问题:只需在 SharePoint Designer(在设计模式下)的列表视图的列中直接输入内容并保存更改。之后,删除您首先输入的字符串并再次保存页面。然后幽灵页面也应该在浏览器中工作。 Link to thread where i found this solution

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-01-17
      • 2011-07-01
      • 2021-02-03
      • 1970-01-01
      • 2016-01-19
      • 1970-01-01
      相关资源
      最近更新 更多