In your XSLT, use <xsl:output method="html"/> and then make sure your HTML result elements created by your stylesheet do not have a namespace. Also, depending on how you use XslCompiledTransform in C # code, you need to make sure that the xsl:output parameters in the stylesheet are respected. You can easily achieve this by converting to a file or stream or TextWriter, in which case nothing needs to be done. However, if for some reason you switch to XmlWriter, you need to make sure that it is created with the appropriate settings, for example.
XslCompiledTransform proc = new XslCompiledTransform(); proc.Load("sheet.xsl"); using (XmlWriter xw = XmlWriter.Create("result.html", proc.OutputSettings)) { proc.Transform("input.xml", null, xw); }
But usually you should be fine just converting to Stream or TextWriter, in which case you donโt need anything in the C # code to honor the output method in the stylesheet.
source share