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:call-template>
</xsl:variable>
<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:call-template>
</xsl:variable>
<xsl:variable name="LinkTarget">
<xsl:if test="@OpenInNewWindow = 'True'" >_blank</xsl:if>
</xsl:variable>

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

==================

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