Exporting XsltListViewWebPart in SharePoint 2013

By default the XsltListViewWebPart does not support export from the web user interface. I often build solutions by configuring the web parts in the browers, exporting and adjusting the defintions and then deploying them with PowerShell. With a few lines of PowerShell this capability can also be enabled for the Xslt List View Web Part.

Before enabling the Export Mode on the webpart:

XsltListViewWebPart-before

After running the PowerShell script and enabling the Export mode:

XsltListViewWebPart-after

PowerShell script

https://gist.github.com/aflyen/5db65f5ab6da792c3ced