Content query rollup not showing description
I'm trying to get some custom views for a content query rollup working in SharePoint 2010. I've made a custom News content type with a few basic columns like title, contents, comments and a custom column to toggle showing it on a certain page (boolean/checkbox).
I've edited my ItemStyle.xsl and added a new view type that has a title, image and description. In the settings of the web part (by default) the value of the description is taken from the 'comments' column. However, the description never shows up, just an empty div.
When I added开发者_如何学编程 the custom column to the description field (along with the comments column) the value of the custom column was shown. I'm 100% certain all the news items in my rollup do have a comment (it's even a required field). Yet somehow whatever I do the description does not show up.
How do I go about debugging this?
The problem may be that your custom column is not being passed into your XSL because it is not included in the CommonViewFields. You can verify this by adding code like this to your ItemStyle.xsl which will echo out all of the underlying XML that it working on:
<textarea><xsl:copy-of select="." /></textarea>
(I put the XML into a textarea so you can see it and copy it without going into the source)
If you do not see your custom column in the XML then you need to add it in. The simplest way is to modify the CommonViewFields property of the Content Query Web Part either in a SharePoint Designer or by exporting the webpart, editing the .webpart file, and then re-importing it.
There is a good explanation of this from MSDN: http://msdn.microsoft.com/en-us/library/aa981241.aspx
So, apparently the Comments field is a backend-only field to add a little description to whatever page you're adding. What I was looking for was the byline.. Glad someone could finally point this out to me.
精彩评论