Reputation: 1371
I have a xml document like below and I need to render it into HTML page. When I browse the XML from IE the HTML is rendered as expected with styling. If I load the xml document from c# code and pass to HTML page it just renders as plain text. What am I missing here?
XML
<?xml-stylesheet type='text/xsl' href='xslsheet.xsl'?>
<Document xmlns="org" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
....
</Document>
C#
XDocument doc = XDocument.Load(@"C\SampleDocument.xml");
var result = doc.ToString();
Upvotes: 0
Views: 764
Reputation: 5480
Loading an XML document does just that - it loads the data. It won't process a transform directive.
To do that you need to do an XSLT Transform. You can find the classes to do that on MSDN.
Upvotes: 1