I was going to remind myself of a technique that I’d seen Liam Cleary use on his blog about importing XSL files into ItemStyles.xsl, but then I noticed that he’d linked to a far better idea from Brendon Swartz – you can change the XSL file that the Content Query Web Part presents ItemStyles for. If you export the Content Query Web Part as an XML file and edit it, you’ll see a property ItemXslLink. Simply give it a url to the new ItemStyles.xsl file.
Personally, I think this is fantastic. Frequently I have been asked to do custom roll-up of content, with customised display. If you have to add to the standard ItemStyles.xsl, then before long your ‘Presentation’ setting for your standard CQWPs is full of highly specific item styles. This way, I can isolate – nearly hide – the existance of my much more specific item styles to general users.
And I’ll say more about what I was doing with it shortly.
This is not possible with MOSS 2007 SP1. Changing the web part doesn’t have any effect. If it worked before, they must have introduced a bug with an update. The reply from MS was “No, you can’t change it, but modifying the existing itemstyle.xsl is supported.”
Um, I tested this on an SP1 system when I wrote this entry, and it worked just fine. Works under SP2 too.