Console Application to test Class Library code - AIF File Transformation
Console application code as follows
- static void Main(string[] args)
- {
- Stream input, output;
- input = File.Open(@"C:\TEMP\ASN.xml", FileMode.Open);
- output = File.Open(@"C:\TEMP\ASN_Output.xml", FileMode.Create);
- StreamReader reader = new StreamReader(input);
- //string contents = reader.ReadToEnd();
- using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("AsnTransform.AsnStylesheet.xslt"))
- {
- XPathDocument document = new XPathDocument(input);
- XPathDocument stylesheet = new XPathDocument(stream);
- XslCompiledTransform transform = new XslCompiledTransform();
- transform.Load(stylesheet);
- XmlWriterSettings settings = new XmlWriterSettings
- {
- OmitXmlDeclaration = false,
- Indent = true
- };
- XmlWriter results = XmlWriter.Create(output, settings);
- transform.Transform((IXPathNavigable)document, null, results);
- results.Close();
- output.Close();
- }
Comments
Post a Comment