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

I'm working on a webpart that extends CoreResultsWebPart. I have create new solution and added new WebPart project into it.

I got most of it working apart from XSL.

I want to use this.XslLink however, I'm not sure how to deploy my XSL file with my webpart (while keeping it as sandbox solution).

Do I need to create another feature (farm) just so I can deploy XSL file?

share|improve this question
    
you can upload your xsl file to one of your document library. –  bagus ilman Aug 1 '12 at 7:07
    
this is exactly what I dont want to do. I want everything to be deployable as a solution rather than having to upload stuff in other places. –  Luke Aug 1 '12 at 20:07
add comment

1 Answer 1

up vote 1 down vote accepted

You can provision the XSL file using a Module element and then reference that xsl file using a site relative url, like this:

<Module Url="Stylesheets">
    <File Path="MyModule\file.xsl" Url="file.xsl"/>
</Module>

and

<XslLink>Stylesheets/file.xsl</XslLink>
share|improve this answer
    
Thank Wictor. I would have to deploy this solution as farm solution then. How do you deploy a file to Style Library/XSL Style Sheets, rather than file system. –  Luke Aug 1 '12 at 21:19
    
This exact code can be used in the sandbox –  Wictor Wilen MCA MCM MVP Aug 1 '12 at 21:32
    
It comes up with is not compatible with Sandboxes solution error. –  Luke Aug 1 '12 at 21:48
    
@Wiktor Thanks. Instead of modifing elements file. I have added new project of type of Module which then deployed files fine. –  Luke Aug 2 '12 at 2:44
    
Awesome Luke! That's a better approach! –  Wictor Wilen MCA MCM MVP Aug 2 '12 at 9:40
add comment

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.