Displaying the DocIcon in the CQWP

Jan 5, 2011 at 5:33 PM

I knew how to get this to work in MOSS 2007.  I added a template to the XSL item stylesheet.  This doesn't seem to work now in SP2010.

When I add "DocIcon" to the Field to Display: Image textbox it changes to "Type [Base Columns]" and not sure how to accommodate this with the XSL code (see template code below).

So then I was thinking I could try adding "DocIcon" to the Imtech "Common View Fields" textbox, but did not produce any results.

I would think this is a commonly wanted feature for CQWPs that display from document librairies.

Let me know if you can help.


<xsl:variable name="DisplayTitle">
<xsl:call-template name="OuterTemplate.GetTitle">
<xsl:with-param name="Title" select="@Title"/>
<xsl:with-param name="UrlColumnName" select="'LinkUrl'"/>
<xsl:variable name="LinkTarget">
<xsl:if test="@OpenInNewWindow = 'True'" >_blank</xsl:if>

<div >
<xsl:when test="@DocIcon=''">
<img src="_layouts/images/folder.gif" alt="" />
<img src="_layouts/images/ic{@DocIcon}.gif" alt="" />
<xsl:call-template name="OuterTemplate.CallPresenceStatusIconTemplate"/>
<a href="{$SafeLinkUrl}" target="{$LinkTarget}" title="{@LinkToolTip}" style="padding-left:5px;">
<xsl:value-of select="$DisplayTitle"/>


Not my XSL code.  Originates from http://edinkapic.blogspot.com/2007/09/document-icon-in-cqwp.html