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"
        exclude-result-prefixes="xsl msxsl ddwrt"
     <xsl:import href="../../styles/ProjectEmailMessagesTemplate.xsl"/>
     <xsl:output method="html" indent="no"/>

    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


    Sunday, February 6, 2011 1:04 AM