SharePoint 2013 Script to update Title link with URL and ID

SharePoint 2013 Script to update Title link with URL and ID

So I needed to create a list data view and have the items title link to a fixed URL path with the item’s ID at the end as a query string parameter.
In SharePoint 2010 I would get this done in SharePoint Designer, adding an empty data view
and editing its XSL.
In 2013 I wanted to do this using JSlink but I found it more complicated than I thought it would be, and I was short on time, so I wrote this simple script that grabs the ID from the last column of the data view and updated the href attribute of the first data view column –

{code type=javascript}

{/code}

In order to get the above script to work make sure:
1. Your SharePoint site has a jQuery reference.
2. Your Data View first column is the title or any other column you want to use as a link.
3. Your Data View last column is the item’s ID.
4. Update the variable “urlPath” with your own path.
5. Update the variable “listName” with your own list’s name.

Using PublishingRollupImage SharePoint column in Content Query or DataView XSLT

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 –
{code type=Html}

{/code}
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:
{code type=Html}

{/code}
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:
{code type=Html}
{@Title}
{/code}
Now the width and height attributes above are obviously changeable.
Hope this helps!