locked
Custom Doclib Template & c# & xsl:stylesheets RRS feed

  • Question

  • Using WSS 3.0

    I have created an event receiver that, among other things, creates a document library from a custom template. The custom template was created using a stock doclib, converting the DataFormWebPart to xslt and customizing the layout of the headers, columns etc. I removed the <xsl:stylesheet> code and placed it in an xsl file which resides in an accessible folder oin the site.

    The c# to created the doclib is standard fair:

     newListID = web.Lists.Add(listTitle, listDescription, doclibTemplate);

    The xsl:stylesheet is referenced from the sharepoint aspx page using:

    <xsl:stylesheet xmlns:x="http://www.w3.org/2001/XMLSchema"
        xmlns:d="http://schemas.microsoft.com/sharepoint/dsp"
        version="1.0"
        exclude-result-prefixes="xsl msxsl ddwrt"
        xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime"
        xmlns:asp="http://schemas.microsoft.com/ASPNET/20"
        xmlns:__designer="http://schemas.microsoft.com/WebParts/v2/DataView/designer"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
        xmlns:msxsl="urn:schemas-microsoft-com:xslt"
        xmlns:SharePoint="Microsoft.SharePoint.WebControls"
        xmlns:ddwrt2="urn:frontpage:internal">
     <xsl:import href="../../styles/ProjectEmailMessagesTemplate.xsl"/>
     <xsl:output method="html" indent="no"/>
    </xsl:stylesheet>

    I can create a doclib using my custom template in the sharepoint gui and it renders exactly as required...however, when the doclib is created using the custom template called from the c# it has an empty DataFormWebPart, I can rightmouse click the empty DFWP in SPD and convert it to xslt and add the custom stylesheet and it works fine, but I need to create the doclib in code.

    Has anyone seen this before? I am at my wits end trying to figure this out.

    Thx in advance

    /wg 

    Sunday, February 6, 2011 1:04 AM