Posts Tagged ‘xsl src’

Hyperlink/Picture Column does not display image

October 24, 2011

I came across a very interesting issue. I had a simple custom SharePoint List library. One of the columns was a “headshot” formatted as a Picture to allow users to paste in a URL of their pictures.

In a SharePoint list view, the picture came out wonderfully. However, I wanted to be a little creative in SharePoint Designer.

So I created my data view and dragged my columns onto the page.

 

The Headshot value turned out to be something like this on the page. “http://intranet-porta/headshots/uzma1.jpg,”

When formatting the “@Headshot” value as a picture link was broken. All images in the list turned out to have an extra “,” at the end of the URL.

The work around is to create a XSL attribute, in my example, I created:

<img>

<xsl:attribute name=”src”>

<xsl:value-of select=”substring-before(@Headshot,’,’)” />

</xsl:attribute>

</img>

And it works like magic!

Advertisements