Using PublishingRollupImage SharePoint column in Content Query or DataView XSLT
Today I had to create a contact spotlight view in a content query web part, which included an image of the contact, my client wanted the contacts list to have a Publishing Rollup Image column, a SharePoint 2010 out of the box column which is friendly for end-users to use, or at least more friendly than the Hyperlink or Picture type column, since it allows users to upload an image directly from their computer into their list item.
But when using the @PublishingRollupImage column within an XSLT list data view or content query web it renders out a complete HTML markup which matches the following –
Now if this html markup is okay with you all you need to do is add a “disable-output-escaping=yes” attribute to your XSL node and the XSL will render your image on the page:
But this allows the end user to upload any size of image and it lacks the ability to set your image style attributes by yourself…
So to get to point – in order to get only the source URL (src attribute) of your Publishing Rollup Image column use the following syntax:
Now the width and height attributes above are obviously changeable.
Hope this helps!