// Collection of code snippets by Arne Vajhøj // (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) using System; using System.IO; using System.Xml; using System.Xml.XPath; using System.Xml.Xsl; namespace E { public class MainClass { public static void Main(string[] args) { string transform = @" "; XmlDocument doc = new XmlDocument(); doc.Load(@"C:\chat.xml"); XslCompiledTransform xslt = new XslCompiledTransform(); xslt.Load(new XmlTextReader(new StringReader(transform)), new XsltSettings(true, true), null); StringWriter sw = new StringWriter(); XmlTextWriter wrt = new XmlTextWriter(sw); wrt.Formatting = Formatting.Indented; xslt.Transform(doc, wrt); Console.WriteLine(sw.ToString()); } } }