XSL: Turning Off XML Declaration

22 December 2008

When using the system.web.ui.webcontorls.xml control to transform an xml file to html (using an xsl stylesheet), the control was adding a <?xml version="1.0" ?> declaration to the output. To turn this off, simple add the following to your xsl transform (inside the xsl:stylesheet node, but outside of any xsl:template nodes).

<xsl:output method="xml" omit-xml-declaration="yes"/>



post a comment / view comments   (currently 0 comments)

Quicknote: Adding a CSS reference from code

13 December 2008

To add a CSS reference from in code, simply do the following:

protected void Page_Init(object sender, EventArgs e)
{
    HtmlLink link = new HtmlLink();
    link.Href = "mystylesheet.css";
    link.Attributes.Add("rel", "stylesheet");
    link.Attributes.Add("type", "text/css");
    Page.Header.Controls.Add(link);
}



post a comment / view comments   (currently 0 comments)