title: How can I specify custom XSL for a List Definition developed in Visual Studio?
body: <p>I am trying to change the hyperlink on the AllItems.aspx page to point to a custom upload page for my document library called CustomUpload.aspx.</p>
  
  <p>Assuming I have two Document Libraries (lists). One called <strong>vsList</strong>, created in Visual Studio and deployed as part of a SharePoint solution and the other called <strong>sdList</strong>, created the usual way from the browser.</p>
  
  <p>Here's what I've been able to successfully accomplish to date:</p>
  
  <ol>
  <li>Edit the AllItems.aspx page of the <strong>sdList</strong> in the web based editor. Customize the XsltListViewWebPart that contains the "Add new item" hyperlink by setting it's Toolbar Type to "Summary". Then, using SharePoint Designer (SPD), I click the "Add new item" hyperlink in the designer view and the little right arrow appears and allows me to edit the hyperlink options (i.e. set the value to my own custom URL).</li>
  <li>Copy and paste the XSL code from above into the AllItems.aspx file for the <strong>vsList</strong> doc library and make sure that the path to the url is correct since of course SharePoint can never find anything because of the crapfest of mapped and virtual directories that "is" SharePoint.</li>
  </ol>
  
  <p>Option #1 isn't a real solution because it only works for doc libraries that are created directly via the web-based GUI editor in the SP portal. I need to have all of this defined in my list definition that I created in VS. As for option #2, the issue is pretty much the same. If I copy and paste the custom XSL into the AllItems.aspx page then it will be overwritten each time I redeploy my VS solution that contains my custom list definition. So really I need a solution that will allow me to define the custom URL in my VS list definition.</p>
  
  <p>Here's what SHOULD work -but doesn't:</p>
  
  <ol>
  <li>Create a custom Xsl file with all the tweaks required to override the default "Add new item" link. Edit the XslLink property of the XsltListViewWebPart in the AllItems.aspx page for the <strong>sdList</strong> document library by using Site Action => Edit Page => Edit Web Part => Miscellaneous => XSL Link.</li>
  <li>Edit the Elements.xml file for the list definition by adding the necessary Module and File XML tags to point to the custom XSL file that would override the "Add new item" URL. No matter what I do it won't deploy when I add in the tags because it just can't find the custom XSL file. </li>
  </ol>
  
  <p>I've tried putting the file in like 100 different places and it keeps trying to look for it in "Features[MY PROJECT NAME]_PrimaryFeature\CustomStyle.xsl". Where does it get the idea that I'm storing the file in that path/location? Even when I try to store the XSL file in the SharePoint mapped LAYOUTS/XSL directory or in the Style Library document library in the actual SharePoint site it still can't find it. It's just maddening. Paths, location, directory structure and XSL have become the biggest roadblocks for me in trying to get anything done in SharePoint.</p>
  
  <p>Please help.</p>