2

I'm attempting to use a Content Query webpart to display a calendar but instead of getting a styled result I get an XML result that looks like this:

<dsQueryResponse>
    <Rows>
      <result data here>
      <result data here>
      ...
    </Rows>
  </dsQueryResponse>

I had to export my webpart and manually edit the web part to point to the ItemStyle.xsl and ContentQueryMain.xsl since I don't have a Style Library folder for some reason.

Here is the template function that I am currently using (however the issue is the same with any template)

 <xsl:template name="RDHP_Events" match="Row[@Style='RDHP_Events']" mode="itemstyle">
        <xsl:param name="CurPos" />
        <xsl:param name="LastRow" /> 
        <xsl:param name="Title" /> 

        <xsl:variable name="RDHP_Title">
                <xsl:value-of select="@Title" />
        </xsl:variable>

        <xsl:variable name="RDHP_EventDate">
                <xsl:value-of select="@EventDate" />
        </xsl:variable>

          <xsl:if test="$CurPos = 1">
            <xsl:text disable-output-escaping="yes"><![CDATA[<div id="RDHP_Events_Cal"><img src="/sites/rd_home/PublishingImages/RDHP/RDHP_Ext_Event_Calendar.jpg" width="243" height="30" alt="R&amp;D Events Calendar" />  <div class="RDHP_Events_Cal_Row"> 
    <div class="RDHP_Events_Cal_Top_Date">DATE</div>
    <div class="RDHP_Events_Cal_Top_Event">EVENT</div>
    </div>
    <script type="text/javascript">
      ctx = new ContextInfo();

      var existingHash = '';
      if(window.location.href.indexOf("#") > -1){
        existingHash = window.location.href.substr(window.location.href.indexOf("#"));
      }
      ctx.existingServerFilterHash = existingHash;
      if (ctx.existingServerFilterHash.indexOf("ServerFilter=") == 1) {
        ctx.existingServerFilterHash = ctx.existingServerFilterHash.replace(/-/g, '&').replace(/&&/g, '-');
        var serverFilterRootFolder = GetUrlKeyValue("RootFolder", true,ctx.existingServerFilterHash);
        var currentRootFolder = GetUrlKeyValue("RootFolder", true);
        if("" == serverFilterRootFolder && "" != currentRootFolder)
        {
          ctx.existingServerFilterHash += "&RootFolder=" + currentRootFolder;
        }
        window.location.hash = '';
        window.location.search = '?' + ctx.existingServerFilterHash.substr("ServerFilter=".length + 1);
      }

          ctx.listBaseType = 0;

      ctx.NavigateForFormsPages = false;
      ctx.listTemplate = "106";
      ctx.listName = "{4CEEBDA9-E896-403F-B07F-DE16B64E8CA2}";
      ctx.view = "{67BF6D15-6B2E-49B7-91BE-8EF6236797AC}";
      ctx.listUrlDir = "/sites/rd_home/Lists/Community%20Events";
      ctx.HttpPath = "https://connect.gsk.com/sites/rd_home/_vti_bin/owssvr.dll?CS=65001";
      ctx.HttpRoot = "https://connect.gsk.com/sites/rd_home";
      ctx.imagesPath = "/_layouts/images/";
      ctx.PortalUrl = "";
      ctx.SendToLocationName = "";
      ctx.SendToLocationUrl = "";

          ctx.RecycleBinEnabled = 1;

      ctx.OfficialFileName = "";
      ctx.OfficialFileNames = "";
      ctx.WriteSecurity = "1";
      ctx.SiteTitle = "R\u0026D Home";
      ctx.ListTitle = "Community Events";
      if (ctx.PortalUrl == "") ctx.PortalUrl = null;
      ctx.displayFormUrl = "https://connect.gsk.com/sites/rd_home/_layouts/listform.aspx?PageType=4&ListId={4CEEBDA9-E896-403F-B07F-DE16B64E8CA2}";
      ctx.editFormUrl = "https://connect.gsk.com/sites/rd_home/_layouts/listform.aspx?PageType=6&ListId={4CEEBDA9-E896-403F-B07F-DE16B64E8CA2}";
      ctx.isWebEditorPreview = 0;
      ctx.ctxId = 2751;
      ctx.isXslView = true;

      if (g_ViewIdToViewCounterMap["{67BF6D15-6B2E-49B7-91BE-8EF6236797AC}"] == null)
          g_ViewIdToViewCounterMap["{67BF6D15-6B2E-49B7-91BE-8EF6236797AC}"]= 2751;
      ctx.CurrentUserId = 28;

        ctx.ContentTypesEnabled = true;

      ctx2751 = ctx;
      g_ctxDict['ctx2751'] = ctx;
    </script>]]></xsl:text>
                        </xsl:if>  


  <div class="RDHP_Events_Cal_Row"> 







<div class="RDHP_Events_Cal_Date"><xsl:value-of select="ddwrt:FormatDateTime(string(@EventDate) ,1033 ,'dd MMM')" />
</div>

 <div class="RDHP_Events_Cal_Mid"><img src="/sites/rd_home/PublishingImages/RDHP/RDHP_Greater_than.gif" width="13" height="12" /></div>

<xsl:text disable-output-escaping="yes"><![CDATA[<div class="RDHP_Events_Cal_Event_Date_div" CTXName="ctx2751" id="]]></xsl:text>

<xsl:value-of select="@ID" disable-output-escaping="yes" />

<xsl:text disable-output-escaping="yes"><![CDATA[" Field="LinkTitle" Perm="0x7fffffffffffffff" EventType="0"><a href="https://connect.gsk.com/sites/rd_home/_layouts/listform.aspx?PageType=4&amp;ListId={4CEEBDA9-E896-403F-B07F-DE16B64E8CA2}&amp;ID=]]></xsl:text>

<xsl:value-of select="@ID" disable-output-escaping="yes" />

<xsl:text disable-output-escaping="yes"><![CDATA[&amp;ContentTypeID=0x010200BA3C83EBA13243D1AEA8EBA290B005FB0080088C6F4532624AB6759DAF6AD8FB1E" onclick="EditLink2(this,2751);return false;" target="_self">]]></xsl:text>




   <xsl:choose>
                    <!-- if YOUR_STRING is greater than the MAXIMUM_LENGTH -->
                    <xsl:when test="string-length($RDHP_Title) &gt; 30" >
                        <!-- print out the truncated value followed by "..." -->
                        <xsl:value-of select="substring($RDHP_Title,0, 30)" disable-output-escaping="yes" />...
                    </xsl:when>
                    <xsl:otherwise>
                        <!-- otherwise print out the whole, un-truncated string -->
                        <xsl:value-of select="$RDHP_Title" disable-output-escaping="yes" />
                    </xsl:otherwise>
                </xsl:choose>     

 <xsl:text disable-output-escaping="yes"><![CDATA[</a></div><div class="s4-ctx" onmouseover="OnChildItem(this.parentNode); return false;"><span> </span><a onfocus="OnChildItem(this.parentNode.parentNode); return false;" onclick="PopMenuFromChevron(event); return false;" href="javascript:;" title="Open Menu"></a><span> </span></div>]]></xsl:text>   

  </div>
        <div style="clear:both"></div>



        <xsl:if test="$CurPos = $LastRow">
            <xsl:text disable-output-escaping="yes"><![CDATA[<div class="RDHP_Events_Cal_Row_btm"> 
    <div class="RDHP_Events_Cal_bottom_left"><a href="https://connect.gsk.com/sites/rd_home/Lists/Community%20Events/calendar.aspx"><img src="/sites/rd_home/PublishingImages/RDHP/RDHP_View_full_cal.jpg" alt="View full calendar" width="112" height="22" border="0" /></a></div>
    <div class="RDHP_Events_Cal_bottom_right"></div><div style="width:15px; float:left; padding-top:7px;"></div>
  </div>
    <div style="clear:both"></div>

      <div class="RDHP_Events_Cal_Row_btm"> 
    <div class="RDHP_Events_Cal_bottom_left"><a href="mailto:jackie.a.staunton@gsk.com; cara.r.krikory@gsk.com?subject=New Event for RD Home Page"><img src="/sites/rd_home/PublishingImages/RDHP/RDHP_Add_new_event.jpg" alt="Add new event" width="109" height="25" border="0" /></a></div>
    <div class="RDHP_Events_Cal_bottom_right"></div>
    </div>]]></xsl:text>

            <!--
                Display all useable elements: 
                <xsl:for-each select="@*">
                    P:<xsl:value-of select="name()" /><br />
                    V:<xsl:value-of select="current()" /><br />
                </xsl:for-each>
            -->
        </xsl:if>
       </xsl:template> 

I haven't used these in a while and I'm completely at a loss as to where to look to further debug and troubleshoot this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.