Sharepoint - XSLT or JSLink (which one to use?)

It depends on what you want to do with it.

The power of using JSLink is that it uses JavaScript and runs in the client and you can use all the powerfull JavaScript libraries and for its easy to debug. It is easy to change the fields appearing and add some nice functionality to views.

The weakness however is that JSLink runs in the client and it depends on JavaScript. Its slower than serverside code. All processing is done after all information is served to the client.

XSLT however is very hard to learn and to read but for some operations it still rocks. Its fast and not depended on the client on how and when some things are rendered.

If you want to do some counting in views for example I found it easier and better performance to use XSLT. For example you want only totals returned for a certain category. When using XSLT you do the serverside processing and only return to information you want to show. Using JSLink it would require getting all information to the client and do some clientside processing.

However doing some nice ui goodness like transforming fields into nice slides etc i think JSLink is the better choice


There are a few advantages of using Client Side Rendering VS XSL.

Performance – Because the rendering is done Client Side, the burden is taken away from the server. This means that the pages can load faster when using CSR. Ease of Development – Let's face it: nobody really likes XSL – especially in SharePoint. All web developers should be familiar with JavaScript, which makes Client Side Rendering a lot easier to pick up. This should mean reduced development time, and less bugs. Flexibility – You can chose to overwrite just a particular field, the header, footer, or the entire view. You can also extend it; you're not limited to using just SharePoint JavaScript to process the list, you can use the whole power of JavaScript, as well as any plugins such as jQuery. The good news is that you don't have to use the JSLink yet if you don't want to. All of the web parts still support XSL, so if you feel more comfortable doing it this way, this should still work. You can simply select "Server Render", and point it to a valid XSL file.

Please refer to this article to learn more about JSLink: http://www.rbradbrook.co.uk/Blog/Post/10/Introduction-to-Client-Side-Rendering-in-SharePoint-2013

Tags:

Xslt