Let’s say I have two strings:
- one is XML data
- and the other is XSL data.
The xml and xsl data are stored in database columns, if you must know.
How can I transform the XML in C# w/o saving the xml and xsl as files first? I would like the output to be a string, too (HTML from the transformation).
It seems C# prefers to transform via files. I couldn’t find a string-input overload for Load() in XslCompiledTransform. So, that’s why I’m asking.
Here’s what I went with. It’s a combination of your answers. I voted up the answers that inspired this:
Note: this statement is required in the xsl, in order to output as HTML: