1

I am using CQWP to display "Page" library from a subsite. This page library contain several fields such as title, roll up image, page content etc.

I am trying to display page content (i.e. body of page) by modifying itemstyle.xsl file but it is not displaying. All other fields are being displayed except this one as it just displays blank. I have tried @PublishingPageContent @Content @Description @Body but no luck.

Here's my code:

<xsl:template name="latestnews" match="Row[@Style='latestnews']" mode="itemstyle">
<div><img src="{@ImageURL}" class="img-responsive"></img></div>
<span style="color:#000000"><xsl:value-of select="@Created"/></span>
<div style="font-size:16px; color:#6A6868; ><xsl:value-of select="@Title"/></div>
<div style="font-size:12px;"><xsl:value-of select="@PublishingPageContent"/></div>
</xsl:template>
1

PublishingPageContent is a List Item column. Using the standard functionality it is not possible to display the content of a page. You could however extend the Content Query Web Part with custom functions which would allow you to retrieve and display the contents of a file/document.

Here is what you need do is - export the content query webpart as below:

enter image description here

Open the .webpart file in a text editor. Inside that, you will find the the below line:

<property name="CommonViewFields" type="string" />

Here you can specify the field names in the format : Internal Name, Column Type

Replace it with the below line if you want multiple columns:

<property name="CommonViewFields" type="string">PublishingPageImage,Image;PublishingPageContent,Note;</property>

or

Replace it with the below line if you want single columns:

<property name="CommonViewFields" type="string">PublishingPageContent,RichHTML;</property>

Check with both PublishingPageContent,RichHTML; or PublishingPageContent,Note;, I am not 100% sure which one works. But its for sure either of them only.

Save the .webpart file. Edit the sharepoint page and upload the webpart. Add the webpart again on the page. After that modify the itemstyle.xsl and then these fields will be rendered on the page.

In the itemstyle, you can refer it now as below:

<div class="description">
  <xsl:value-of select="@PublishingPageContent" disable-output-escaping="yes"/>  
</div>

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.