using .NET XslCompiledTransform?
-
Sorry for bumb nood question. I can't figure out how to transform an XML that I have in a string variable (not a file) using XSLT that is also in a string (not a file) and get the result as a string as well? All I see there is "Load" methods which take paths to files or XmlReader (which I'm not sure how force to use my strings) or some other wierd stuff. Please help!
-
Sorry for bumb nood question. I can't figure out how to transform an XML that I have in a string variable (not a file) using XSLT that is also in a string (not a file) and get the result as a string as well? All I see there is "Load" methods which take paths to files or XmlReader (which I'm not sure how force to use my strings) or some other wierd stuff. Please help!
inner wrote:
XmlReader
string sxml = "<test>testing this</test>";
System.IO.StringReader reader = new StringReader(sxml);
XslCompiledTransform transform = new XslCompiledTransform();
transform.Load(XmlReader.Create(reader));"Just about every question you've asked over the last 3-4 days has been "urgent". Perhaps a little planning would be helpful?"
Colin Angus Mackay in the C# forumled mike
-
inner wrote:
XmlReader
string sxml = "<test>testing this</test>";
System.IO.StringReader reader = new StringReader(sxml);
XslCompiledTransform transform = new XslCompiledTransform();
transform.Load(XmlReader.Create(reader));"Just about every question you've asked over the last 3-4 days has been "urgent". Perhaps a little planning would be helpful?"
Colin Angus Mackay in the C# forumled mike
I face the same problem... The point I have no solution to till now is making the XslCompiledTransform object put its output in a string variable... :confused: Any idea???
-
I face the same problem... The point I have no solution to till now is making the XslCompiledTransform object put its output in a string variable... :confused: Any idea???
Continuing from the previous example:
string strXml = ...;
string strXsl = ...;
XslCompiledTransform trans = new XslCompiledTransform();
trans.Load(XmlReader.Create(new StringReader(strXsl)));StringBuilder sb = new StringBuilder();
trans.Transform(XmlReader.Create(new StringReader(strXml)), XmlWriter.Create(sb));
string outXml = sb.ToString();
Logifusion[^] If not entertaining, write your Congressman.