1

I am trying to display columns from 2 different lists in a site in CQWP. Most of the blogs and MSDN articles asks to modify the xslt file, ContentQueryMain.xsl and ItemStyle.xsl, for displaying additional columns. When I opened my site in SPD, I cannot find the Styles Library folder. Is there any specific settings? Also all the articles displays example to show additional column from single list. I have 2 lists with same columns, Title and Description (Multiline rich textbox) and I want to display basically Description in CQWP. Please help.

1 Answer 1

3

The ContentQueryMain.xsl and ItemStyle.xsl are located in the Style Library in the RootSite of the sitecollection. Do not update the default styles defined is those files (others may depend on it). Rather add a new style to the file, or copy the files and update the references in the CQWP to the new XSL-files. To do this: export the webpart and update the corresponding properties: HeaderXslLink, ItemXslLink and MainXslLink.

In order to query multiple lists you must override the <property name="ListsOverride" type="string" /> value in the webpart definition file. To do this, export the webpart. Open the file with your favorite xml/texteditor (notepad? visualstudio?). And update the property to: <property name="ListsOverride" type="string"><![CDATA[<Lists><List ID="31A7C09D-52CC-4585-B998-A3F180A9BD07"/><List ID="7382D66D-2E4C-47CB-A95C-5EECD68F5E61"/></Lists> ]]></property>. Use the ID's of the lists you want to query. When done import the webpart again. (source)

4
  • Thanks a lot. Just one more query. Is it possible to display the top 1 item from each list rather than all list items?
    – Ashish
    Oct 21, 2011 at 9:33
  • Hmm, that depends on the data in your lists. And you probably have to write your own CAML-query (use the QueryOverride property).
    – Dribbel
    Oct 21, 2011 at 9:52
  • I am still not able to display rich text content. I modified all settings. I can see my formatted text in textual format with some style sheets. Any help?
    – Ashish
    Oct 21, 2011 at 11:06
  • 1
    Rich Text is stored as HTML in the Database, use <xsl:value-of select="somevalue" disable-output-escaping="yes" /> to display it. Otherwise all special char will be html-escaped (& -> &amp;)
    – Dribbel
    Oct 21, 2011 at 11:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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