SharePoint XSLT $AllRows 迭代在实时 SharePoint 网站上表现异常

发布于 2024-10-06 23:45:30 字数 1925 浏览 1 评论 0原文

我是 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 网站上不起作用的任何想法?任何见解将不胜感激!

I'm new to XSLT, and I'm also new to Sharepoint.

I've modified my XLV Web Part so that it has the following 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() >= $FirstRow and position() <= $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>

When I view my WebPart in Design mode in SharePoint designer, the list items are populated as I would expect.

But when I publish my changes to the SharePoint site, three of the values are returned as blank. These values are the values inside of the for-each statement: @Date, @Text, and @Link.

I've searched for answers. To no avail. Any ideas as to why this code doesn't work on my live Sharepoint site? Any insights would be greatly appreciated!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

只等公子 2024-10-13 23:45:30

他们的 AllRows 变量声明有问题。看起来它要么是空行。

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

their is a problem with your declaration of AllRows variable. it seems its getting either epmpty rows.

Kindly check the conditional part of filter statement which looks like the problamitic area. i would recommend first remove the conditional part and check if the data is completely retrieved. and then modify your filter statement

哭了丶谁疼 2024-10-13 23:45:30

就我而言,这是 SPD 错误,代码更改未应用于页面,而是显示在 SPD 中。接下来的操作已解决此问题:只需在 SharePoint Designer(设计模式下)的列表视图的列中直接输入内容并保存更改即可。之后,删除您首先输入的字符串并再次保存页面。那么幽灵页面应该也可以在浏览器中工作。
链接到我找到此解决方案的线程

In my case, it was SPD bug, when changes in code was not applied to page, but was displayed in SPD. Next actions have solved this problem: Just enter something directly in a column of the list view in SharePoint Designer (In Design Mode) and save the changes. After that, remove the string you entered first and save the page again. Then the ghost page should work also in browser.
Link to thread where i found this solution

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文