FileInfo fi = new FileInfo(PathTextBox.Text);
XPathDocument xpdoc = new XPathDocument(fi.FullName);
XslTransform componentTransform = new XslTransform();
componentTransform.Load(Path.Combine(di.FullName, "ComponentFile.xslt"));
string outputComponentFile = Path.Combine(fi.Directory.FullName, Path.ChangeExtension(fi.Name, "xml"));
Encoding utf8 = new UTF8Encoding(false);
XmlTextWriter componentWriter = new XmlTextWriter(outputComponentFile, utf8);
componentWriter.Formatting = Formatting.Indented;
componentWriter.WriteStartDocument();
componentTransform.Transform(xpdoc, null, componentWriter);
componentWriter.Close(); |