Why bother with XSLT?

Nov 22, 2013 at 4:43 PM
It seems that Spservices (thank you for this god send) can do anything that you might want to do with a content query webpart or other webpart... am I missing something? Why should I bother to learn XSLT?

Nov 24, 2013 at 5:21 AM
Edited Nov 24, 2013 at 5:21 AM

I started writing a response, and it turned into a blog post: From the SPServices Discussions: Why Should I Bother to Learn XSLT?

Nov 25, 2013 at 12:20 PM
Thank you Mark, for your reply but I am still a little confused... or too be honest I probably don't know enough about the capabilities of DVWP. Can you give a specific example of task that is better suited to DVWP than Spservices?

Nov 25, 2013 at 1:15 PM
Say you want to show the total sales from a list that has 1,000,000 or even 10,000 items. To do this client side, you'd need to request all 1,000,000 items and calculate the total on the client machine. Using a DVWP, the calculation happens on the WFE, so the data never has to travel over the network. (Technically it has to travel from SQL Server to the WFE, but that's going to be a very fast connection.)

Nov 25, 2013 at 1:42 PM
just a heads up: with a million items, you might hit the xslt timeout.
Nov 25, 2013 at 2:18 PM
Absolutely, depending on a number of factors, such as SharePoint version, threshold limits, WFE specs, and the phase of the moon. I intended it as a simple example.

Nov 25, 2013 at 3:18 PM
Edited Nov 25, 2013 at 3:27 PM
What I've always done to get my rollup values was create a view with Counts/Averages or whatever other calculation. After that, it's a matter of AJAX'ing that page and scraping the values. If you are worried about the view being deleted, you can create the view on the fly first, if it's not present.

A very simple implementation:
$.ajax("/site/Lists/ProjectTasks/RollupView.aspx", {
    success: function(data, status) {
        var $assignedTo = $(data).find("div[name='AssignedTo']").closest("th"),
            assignedToIndex = $assignedTo.index()
            $countsRow = $assignedTo.closest("tr").next(),
            $count = $countsRow.find("td").eq( assignedToIndex )

        console.log( $count.text() )