// 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.Xsl; namespace E { class MainClass { public static void Main(string[] args) { string input = @" a bb ccc 1 22 333 "; string transform = @" "; XmlDocument doc = new XmlDocument(); doc.LoadXml(input); XslTransform xslt = new XslTransform(); xslt.Load(new XmlTextReader(new StringReader(transform)), null, null); StringWriter sw = new StringWriter(); XmlTextWriter wrt = new XmlTextWriter(sw); wrt.Formatting = Formatting.Indented; xslt.Transform(doc, null, wrt, null); Console.WriteLine(sw.ToString()); } } }