SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I know i can show document attachments this way:

<xsl:element name="SharePoint:AttachmentsField">
          <xsl:attribute name="runat">server</xsl:attribute>
          <xsl:attribute name="ListId">
                 {27A5A2ED-76FB-4DE3-8206-B4BE32C09CFC} </xsl:attribute>
          <xsl:attribute name="FieldName">Attachments</xsl:attribute>
          <xsl:attribute name="ControlMode">Display</xsl:attribute>
          <xsl:attribute name="Visible">true</xsl:attribute>
          <xsl:attribute name="ItemId">
              <xsl:value-of select="@ID"/>


But the problem is how can i show it as an image?Not link to the text. Also how can i have it open in a new window. In SP 2007 it was possible :( Thanks in Advance

share|improve this question

If you dump just @Attachments in the XSLT, it should return 1 (attachments exist) or 0 (no attachements exist). From there, you can put in some logic to say that if @Attachments = 1 then create an image to _layouts/images/attach.gif.

share|improve this answer
Thanks PirateEcir and Nandy. But i need the full URL of the attached document. I want to show the file attached as an image. Hope i have elaborated enough – naijacoder May 8 '12 at 2:35

You can create calculate column in SharePoint list and show that column in DataView Web Part instead of attachment column field.

Thanks, Nandy

share|improve this answer
While this post may answer the question, we prefer more details such as "why" and "how". Please edit your post with additional details, perhaps an example. See answer for general guidelines. Thanks. – SPDoctor May 7 '12 at 8:40

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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