In my situation, I'm creating web part pages with XsltListViewWebParts on them. I need to set a predefined view on them, with custom filtering / columns setup in CAML. Therefore, I tried moving the XmlDefinition bit out of the web part so I can just reference the proper definition.
I also tried the following:
Saving the XsltListViewWebPart with the correct view setup as an .webpart file, and adding it to the web part gallery. This works great for the site on which the part was created, but as soon as I restore it elsewhere; the definition is reset. Notice that when I export; I explicitely choose the option to NOT use the local list, but a relative /Lists/Listname list.
When I programmatically add the the webpart to the page, it's also possible (with some hacks) to get the embedded view. Although it is possible to setup some things here (like the columns shown); this is not ideal. Also, it seems to always revert back to view BaseTypeId="0" which doesn't have paging. I haven't found any options to change this.
The default view shown (which I don't want) seemed to be the default view of the list itself. So I tried changing that before adding the webpart to the page, but that changes nothing.
Finally, there's an option called XmlDefinitionLink. This promises to load a custom view definition from an XML file. Since that's pretty much what I need, I tried that too. No matter how I set it up, it just won't work. I don't get any errors, but no results either. There seem to be 0 resources available on how to get this working, only an MSDN article telling me that it should be great (which it obviously isn't).
If someone has successfully reused the XSLTListViewWebPart with a custom view definition, please share your knowledge. I don't mind writing a bunch of code or wrapper classes to get there, as long as I know I can actually get there. It's taken up a lot of time up till now, without any result.