I have some document URLs stored in a Sharepoint publishing column. When I output the info into a HTML page using:
<xsl:value-of select="@[ColumnName]" />
in ItemStyle.xml
, I get [url]
, [document name]
in the page. I would like to display this as a URL can anyone help with the XSL?
The easiest way to do this is with SharePoint designer:
This hopefully helps. It shows "Project Site" when the hyperlink is entered and spaces when not.
In SharePoint 2013 you have to do things a bit differently because the
@Url
attribute is is no longer delimited with a comma. There is now a.desc
sub property of@Url
. Below is an example of how this works hopefully this saves someone else some time.Another thing you can do is to take a list that shows URLs properly (like a Links list) and use SharePoint Designer to convert it to a DataView WebPart. In there will be the proper XSL for doing the conversion.
You could use:
or whatever the separator is.
Thanks everyone, in the end I figured out the following based on a post at sguk
with the following a tag code:
or for an image:
with the following img tag:
I'm posting the solution back here as this proved ludicrously hard to figure out (probably my fault as I don't really 'get' XSL) but just in case anybody is looking for it, this code outputs images or links from the 'Hyperlink or Picture' column type in Sharepoint.