Multiple columns on Content Query Web Part

By default the Content Query Web Part has some preset templates, but the chance that one of them fits your needs is small if you would like to show several columns on the web part.

First you need to make enough slots for it to show by editing the ItemStyle.xsl in Style Library/XSL Style Sheets.

Make your own template and add e.g. these lines:

<div class="description">
<xsl:value-of select="@ProjectProperty.Title" />
<xsl:value-of select="@Status" />
<xsl:value-of select="@Priority" />
<xsl:value-of select='ddwrt:FormatDate(string(@DueDate),1044,1)' />
<xsl:value-of select='format-number(@PercentComplete,"#%")' />

On your webpart now, you can change the template in “presentation” to your style template.

And on the slots, you can fill in which column to show;

In my case, I didn’t know the column names, so I want to Site Settings > Galleries > Site Columns and wrote them like this: ColumnName [Group] (in my case Oppgavestatus [Kjerneoppgave- og problemkolonner] )

Tips: You can map more than one column into the slot but only the first non-blank column value will be shown.

To show these result in a table/grid view:


4 thoughts on “Multiple columns on Content Query Web Part

  1. Jannik Mortensen


    My making the changed you propose, i get no extra slots to fill out with my columns. Im on Sharepoint 2013, does it make a difference?

    1. williamwmy Post author

      I don’t think they have changed that part, but I don’t have a 2013 environment ready. Did you manage to create your own custom template ?

  2. Navid

    Hi Mate
    I tried the same approach in SharePoint 2013 but no success. I want to display a specific “Site Column” while the Source section in the CQWP is marked the first one which is “Show items from all sites in this site collection”.

    But after writing the custom field in itemstyle.xsl it can’t be set in web part and can’t be saved. Only Title is shown and works.

    However when I change the Source to a specific list (3rd option), it works. But I want the first option as it check all the site collection.

    Do you have any idea?


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s