// Collection of code snippets by Arne Vajhøj // (from articles on eksperten.dk / vajhoej.dk written sometime between 2004 and now) using System; using System.IO; using System.Xml; using System.Xml.Xsl; namespace XmlProc.XSLT { public class Program { private const string XML_FILE = @"C:\work\employees.xml"; private const string XSL_FILE = @"C:\work\employees.xsl"; public static void Main(string[] args) { // transform from one file to another file XslCompiledTransform xslt = new XslCompiledTransform(); xslt.Load(XSL_FILE); using(StreamWriter sw = new StreamWriter(@"C:\work\employees2.xml")) { XmlWriterSettings xws = new XmlWriterSettings(); xws.Indent = true; XmlWriter xw = XmlWriter.Create(sw, xws); xslt.Transform(XML_FILE, xw); } } } }