Вопрос

I am attempting to use the following solution from Marc D Anderson's blog to display LinkList data in a Content Query Web Part: http://sympmarc.com/2011/02/15/displaying-links-lists-urls-in-a-content-query-web-part-cqwp-in-sharepoint-2010/

...But it seems that nothing is displayed. I know it is pulling items because of the repeated rows that are displayed, but there is no text at all.

The following is the XSL code I have placed in itemstyle.xsl:

<!-- Markup to display LinkList content in a Content Query WebPart -->
<xsl:template name="LinkList" match="Row[@Style='LinkList']" mode="itemstyle">
     <xsl:variable name="SafeLinkUrl">
         <xsl:call-template name="OuterTemplate.GetSafeLink">
             <xsl:with-param name="UrlColumnName" select="@URL"/>
         </xsl:call-template>
     </xsl:variable>
     <xsl:variable name="DisplayTitle">
         <xsl:call-template name="OuterTemplate.GetTitle">
             <xsl:with-param name="Title" select="@URL"/>
             <xsl:with-param name="UrlColumnName" select="'LinkUrl'"/>
         </xsl:call-template>
     </xsl:variable>
     <xsl:variable name="TheLink">
      <xsl:value-of select="substring-before($DisplayTitle,',')"/>
     </xsl:variable>
     <div id="linkitem">
         <xsl:call-template name="OuterTemplate.CallPresenceStatusIconTemplate"/>         
         <a href="{$TheLink}" target="_blank" title="This link opens in a new window">
         <xsl:value-of select="substring-after($DisplayTitle,',')"/>
         </a>
     </div>

 </xsl:template>

When rendered, this is the HTML that is displayed inside the CQWP:

    <div WebPartID="b446f621-351a-4f7e-8749-026fdb9178f0" HasPers="false" id="WebPartWPQ2" width="100%" class="ms-WPBody noindex ms-wpContentDivSpace" style="">
      <div id="cbqwpctl00_m_g_b446f621_351a_4f7e_8749_026fdb9178f0" class="cbq-layout-main">
        <ul class="dfwp-column dfwp-list" style="width:100%" >
          <li class="dfwp-item">
            <div id="linkitem" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime">
              <a href="" target="_blank" title="This link opens in a new window"></a>
            </div>
         </li>
         <li class="dfwp-item">
           <div id="linkitem" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime">
             <a href="" target="_blank" title="This link opens in a new window"></a>
           </div>
         </li>
         <li class="dfwp-item">
         <div id="linkitem" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime">
           <a href="" target="_blank" title="This link opens in a new window"></a>
         </div>
       </li>
       <li class="dfwp-item">
       <div id="linkitem" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime">
         <a href="" target="_blank" title="This link opens in a new window"></a>
       </div>
     </li>
   </ul>
</div>
</div>

I cannot understand why the fields are blank. I suppose it isn't receiving a value for something ($DisplayTitle most likely) but my lack in understanding of SharePoint-specific XSL is getting in the way of finding a solution. Any help would be greatly appreciated!

Это было полезно?

Решение

I figured it out. I was using "URL" in the "values to display" field when I should have been using "Link". Simple, silly error on my part.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с sharepoint.stackexchange
scroll top