This week I have been doing some work with SharePoint Designer 2010 and the XsltListView web part in anger for the first time. I’d heard great things about this web part and was looking forward to exploiting the power of modifying the presentation of a list’s contents without having to go to the lengths of creating a Content Query Web Part or a Data Form Web Part. Also, it’s fun to learn something new!
Well my first experiences have been a little iffy to say the least. It’s more than likely that I’m missing a step, or not quite making the changes as I should be, but I found all my changes constantly being reverted or lost! What I was doing was:
- Inserting a new datasource onto a page, resulting in an XsltListView web part
- Selecting ‘Customize XSL’ from the Design tab on the ribbon – resulting in an ‘extra’ 1500 lines worth of XSL being injected into the page!
- Modifying the XSL templates to create the layout I wanted
- Checking the changes in the browser or the design view in SPD
The problem I had was that seemingly at random, but very regular, intervals my changes were disappearing completely! I was completely at a loss. This combined with the fact SPD had gone back to the good old days of crashing every 15 minutes meant that I was not having a particularly good day.
What helped me out was seeing various sites and posts on the MSDN forums which mentioned the property ddwrt:ghost in the main <XSL> tag but which did not have a value set for it. By default this was set to show_all. I wasn’t sure if it was this or the design view of SPD which was forcing my changes to be lost but after removing the value to leave simply ddwrt:ghost=”” I seemed to fare much better. My changes to the XSL are no longer removed and reverted back to the original.
I’m not sure exactly what was/ is going on – but I’d guess something to do with ghosting 🙂 Hopefully with a bit more playing around I can narrow down exactly what the problem is (or learn how to do it right).
I think on an unrelated note, I’m also seeing quite a few changes within my XSL disappear now and again. It’s as if SPD is just stripping out whole sections that it doesn’t agree with! I’ve no idea what this is all about, but for now I’m trying to just use the code view to see if that will help minimise these frustrating problems.