3

I have done a fair amount of experminting with this but cannot get it to work and I'm now looking for pointers or working examples.

I want to customise the output of the Content Query Web Part to remove the:

<li class="dfwp-item"> </li> 

tags that wrap each item of the CQWP.

I know that these are stored in the ContentQueryMain.xsl and I can see the variable (correct me if I'm wrong) that defines these opening and closing tags at the top of ContentQueryMain.xsl

<xsl:variable name="BeginListItem" select="string('&lt;li class=&quot;dfwp-item&quot;&gt;')" />
<xsl:variable name="EndListItem" select="string('&lt;/li&gt;')" />

The problem is when I point an exported CQWP at a duplicate of the ContentQueryMain.xsl I get the generic this WebPart cannot display/render error and I'm stumped as to where to look. I figure it could be syntax or it could be that when overriding such a fundamental part it needs a little more care and attention.

Any ideas?

Thanks

4
  • are you doing .wsp deployment, or editing a page/view/form via SharePoint Designer?
    – bkwdesign
    Jan 3, 2013 at 19:07
  • I have been exporting a clean CQWP, opening it in Notepad and changing the MainXSL and ItemXSL properties to look at duplicate XSL Stylesheets in the root Style Library. I've been having quite a lot of success just pointing at a different ItemStyle.xsl but it all goes nuts when I alter MainXSL. I will then import or add it to the Web Part Gallery and then insert it in the page.
    – mtwelve
    Jan 3, 2013 at 23:44
  • Do you have access to the server logs? Check 14\LOGS and see if any errors are logged at the same time. Also, if you don't have it turned on already, enable the developer dashboard and view the trace log for the page. See here to enable to the dashboard: blogs.technet.com/b/speschka/archive/2009/10/28/… Jan 6, 2013 at 19:17
  • To be more specific the page will load ok with the custom WebPart but when I goto edit the WebPart properties to specify where to pull the items from and display in the custom style I get the error page offering me the Maintence Page...? There is plenty of content on the Dashboard that seems to be replicated in the ULS but I dont really know where to begin.
    – mtwelve
    Jan 21, 2013 at 12:39

2 Answers 2

1

Noticed a post on MSDN related to this very issue. His workaround sounds similar to what you've done, except he makes copies of files into a sub dir:

create a new Folder under XSL Style Sheets and just get the copy of both ContentQueryMain.xsl and ItemStyle.xsl to the newly created folder. After that [make changes] for BeginList, EndList, BeginListItem and EndListItem

1
  1. Create new style in ItemStyle.xsl xsl:template name="MyNewStyleName" match="Row[@Style='LoanerRequestCustomStyleTwo']" mode="itemstyle" /xsl:templet
    1. In ContentQueryMain.xsl In " xsl:template name="OuterTemplate.CallHeaderTemplate"> " Tag

Search for xsl:value-of disable-output-escaping="yes" select="$BeginListItem" / Usually can be found on the first 10 line if any param declared

Replace it xsl:choose> xsl:when test="@Style='MyNewStyleNam'"> !--xsl:variable name="BegiMyNewStyleNamListItem" select="string('<li class="none">')" /> -->
/xsl:when> xsl:otherwise> xsl:value-of disable-output-escaping="yes" select="$BeginListItem" />
/xsl:otherwise> /xsl:choose>

Search For

xsl:value-of disable-output-escaping="yes" select="$EndListItem" /> This is the last code before closing tag /xsl:template>

REplace it with

xsl:choose> xsl:when test="@Style='MyNewStyleName'"> !-- xsl:value-of disable-output-escaping="yes" select="$EndMyNewStyleNameListItem" /> -->
/xsl:when> xsl:otherwise>
/xsl:otherwise> /xsl:choose>

Note: Sorry have no time yo format --- I have removed all "<" to show the code You can change the commented tag to any format you like just replace the string portion --- select="string('<li class="none">')

Good Luck Wondwossen Belay

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.