I have an XML-file with known structure, but I can’t change anything on it.
The task is to show data from this XML in browser (C# WebBrowser control) perhaps as html using some style sheet.
The question is how I could apply transform on existing XML without inserting anything like
<?xml-stylesheet type="text/xsl" href="my-style.xsl"?>
I’m thinking of copy an XML somewhere, then add this xml-stylesheet and then show it in browser. But maybe I can dynamically apply style-sheet somehow?
Maybe it’s possible to hold an XML in memory, apply style-sheet, and load in-memory xml to WebBrowser control?
I’m just wondering what is the best way for doing this…
Sure, you can! Look at
XslCompiledTransformclass. So you can transform your XML in memory, then load transformed document.