I am trying to create a webpart that would take blog posts from subsites under site and roll them up. I found a blog that describes exactly what I am trying to achieve here. After following these steps:

  1. Add CQWP to page and set content type values
  2. Export the webpart and modify CommonViewFields to add fields

    <property name="CommonViewFields" type="string">Title, Text;PublishedDate, DateTime;Body, RichHTML;Author, Text;NumComments, Lookup;PostCategory, Lookup;</property>
  3. Save, upload and select the webpart again

  4. Modify ItemStyle.xsl from style library to include namespace:


    and new template:

    <xsl:template name="BlogPost" match="Row[@Style='BlogPost']" mode="itemstyle"> 
        <xsl:variable name="SafeLinkUrl"> 
            <xsl:call-template name="OuterTemplate.GetSafeLink"> 
                <xsl:with-param name="UrlColumnName" select="'LinkUrl'"/> 
        <xsl:variable name="DisplayTitle"> 
            <xsl:call-template name="OuterTemplate.GetTitle"> 
                <xsl:with-param name="Title" select="@Title"/> 
                <xsl:with-param name="UrlColumnName" select="'LinkUrl'"/> 
        <div class="custom_posttitle"> 
            <xsl:call-template name="OuterTemplate.CallPresenceStatusIconTemplate"/> 
            <a href="{$SafeLinkUrl}" title="{@LinkToolTip}"> 
              <xsl:if test="$ItemsHaveStreams = 'True'"> 
                <xsl:attribute name="onclick"> 
                  <xsl:value-of select="@OnClickForWebRendering"/> 
              <xsl:if test="$ItemsHaveStreams != 'True' and @OpenInNewWindow = 'True'"> 
                <xsl:attribute name="onclick"> 
                  <xsl:value-of disable-output-escaping="yes" select="$OnClickTargetAttribute"/> 
              <xsl:value-of select="$DisplayTitle"/> 
    <xsl:variable name="StartDate"> 
        <xsl:value-of select="ddwrt:FormatDateTime(string(@PublishedDate), 1033, 'g')" /> 
    <div class="custom_date"> 
            <xsl:value-of select="$StartDate" /> 
    <div class="custom_description"> 
            <xsl:value-of select="@Body" disable-output-escaping="yes" /> 
        <table class="custom_postdetails" border="0" cellpadding="0" cellspacing="0"> 
                <td class="custom_author"> 
                        By: <xsl:value-of select="@Author" /> | 
                <td class="custom_comments"> 
                        Comments: <xsl:value-of select="@NumComments" /> | 
                <td class="custom_category"> 
                        Category: <xsl:value-of select="@PostCategory" /> 

  5. Finally return to page and edit webpart; when i try I get an error, can't edit webpart. Now it seems I cannot edit content query webparts through browser at all without getting this error.

This is on my dev system so I am running under system account which is owner of everything. The ItemStyle is checked in and published, and there isn't an option for approval (which i am pretty sure means that as owner when I publish, there is no approval).

Yeah I know that I am asking for things like this when I grab some sample from online and post, but I am trying to learn this approach and I am simply wondering if someone might know why this is happening because of something I missed?

Always appreciated! Thanks!

1 Answer 1


so just in case anyone is where i am at and experiencing the same trouble, i was able to resolve this by changing Body from RichHTML to Note in the .webpart file. I had a syntax error in the ItemStyle as well, but the above was correct.

  • 1
    While you've exported the .webpart file, you might as well make a copy of ItemStyle.xsl and point it to that - that way if you break it, you only break your web part and not every instance on the website.
    – James Love
    Aug 4, 2012 at 10:47
  • cool. thanks, didn't even know I could do that.
    – Justin
    Aug 10, 2012 at 14:14

Your Answer

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

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