0

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?

Stephan Muller
  • 27,018
  • 16
  • 85
  • 126

2 Answers2

1

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

Peter Jacoby
  • 2,406
  • 25
  • 26
  • Hmm, the strange thing is that in the settings of my webpart I both put 'Comment' and my custom column in the same field, yet only the latter shows up. When I use your code I do see the comment in there, but it only has a name like _x007B_etc, not a proper name. – Stephan Muller Nov 10 '10 at 15:10
  • (the text box is really useful though for debugging, so thanks for that tip) – Stephan Muller Nov 10 '10 at 15:11
  • Make sure you are using the Internal name of the column which may be different from the display name. That can affect whether your column is added correctly to the view. – Peter Jacoby Nov 10 '10 at 15:29
  • I double-checked and I'm definitely using the right internal reference – Stephan Muller Nov 12 '10 at 10:56
  • I deleted my content type and started a new rollup with an already existing type. Also reverted the xsl to the site definition. Still the same problem.. :/ – Stephan Muller Nov 17 '10 at 14:50
0

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.

Stephan Muller
  • 27,018
  • 16
  • 85
  • 126
  • Does the 'description' field fall under the same category of "back-end only". I'm having an issue similar to yours, and was hoping that I could use the description field in a content query rollup. – Markus Aug 29 '12 at 14:09