Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Some Background...

I have created a custom blog web template (which I started by copying and pasting the OOTB blog site definition) and in order to customise the way blog posts are displayed, I have to make some changes to the "blog.xsl" file.

NB: Since I am working on an Office 365 / sandbox solution, changing the "blog.xsl" in the 14 hive is definitely not an option -- nor is deploying a customised version of the file to the file system.

So I have instead created a copy of the "blog.xsl" file within Visual Studio, made my customisations to it, and deployed it to the Style Library. So far so good. The final step is just to hook up the various views in my blog lists' "schema.xml" files to point to my customised XSL file.

The Problem...

The list view's XslLink property appears to be hard-coded to point to the "14\TEMPLATE\LAYOUTS\XSL" directory. For example, the OOTB blog site definition just contains the following for its list views:

<XslLink>blog.xsl</XslLink>

Notice there is no path specified. If I attempt to put either an absolute or relative URL into this field (e.g. /Style Library/XSL/blog.xsl), an exception is thrown on the page and the following message is output to the ULS logs:

Error while executing web part: System.NotSupportedException: The given path's format is not supported.

My Question...

How do I point a list view to a custom XSL file that is deployed to the content database (as opposed to the filesystem)?

share|improve this question
    
I m also facing the same problem with no luck so far, did you try <Xsl> to apply your style. –  bkk Apr 14 at 14:40

2 Answers 2

You approach looks correct though I usually do this through the browser. Have you tried pointing to this XSL from a single view to confirm it works OK? Assuming it does then it is down to the way the code is expecting the format - maybe replace the space in Style Library with %20?

share|improve this answer
    
Hi Dave. If I manually copy my XSL to the filesystem on my dev machine everything works great, so there's no errors there. Obviously this won't be an option for me in prod as we have to deploy to SharePoint Online. I've also tried removing the space as you suggested, but still no luck. Plus -- I can't upload the XSL via the browser as it's part of a site template and so needs to be deployed automatically as part of the site provisioning process. –  Nick Larter Mar 16 '13 at 1:56
    
Are all the sites within a single site collection? If so then the XSLT file should be able to reside in the Style Library (or any other document library) and link to it from there. Try editing one of the pages in the browser, edit the web part and in Miscellaneous section set the XSL Link to point to your file in the Style Library. –  Dave Paylor Mar 16 '13 at 3:06
    
Yes, all sites are within a single site collection. Unfortunately though, using the browser to hook-up my custom XSL isn't a viable option because it'0s used to render my custom blog template's home page and so it needs to be setup automatically when the site is being provisioned (we can't expect end users to manually execute some steps to brand their sites properly). –  Nick Larter Mar 21 '13 at 8:37
    
Yes, I understand. Then this has to be referred to a developer rather than me I am afraid. Good luck –  Dave Paylor Mar 21 '13 at 11:39
    
I think Dave was suggesting the manual approach just to confirm the path would work in the Style Library. I'm pretty sure I've used custom XslLink pointing to a file in the Style Library before, it should work. Once you can confirm the correct format through the browser, you'll be one less step away from your solution. OTOH, the blog's template is notoriously hard to customize, a lot of it is hardcoded. You might also have some luck with JsLink (but it would mean rewriting your custom layout) –  Louis Mar 26 at 2:03

Using JSLink is the best possible way with regards to SharePoint 2013 Online.

enter image description here

You will be able to provide links to files under SP Content DB

Please Ref. Using JSLink to change the UI of a SharePoint list/view

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.