1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Xml; using System.Xml.Xsl; using System.Xml.XPath; using System.IO; namespace ConsoleXSLTest { class Program { static void Main(string[] args) { XmlDocument docXml = new XmlDocument(); XslCompiledTransform xslt = new XslCompiledTransform(); StringWriter stringWriter = new StringWriter(); string sDPW8 = Path.GetFileName(“DPW8.xml”); xslt.Load(Path.GetFileName(“DPW8.xsl”)); docXml = new XmlDocument(); docXml.PreserveWhitespace = false; docXml.LoadXml(sDPW8); xslt.Transform(docXml, null, stringWriter); docXml.LoadXml(stringWriter.ToString()); Console.WriteLine(docXml.OuterXml); } } } |