Exemplo n.º 1
0
        public void Execute(string xmlFilePath, string xslFilePath, string outputDirectory)
        {
            var xslt  = new FileInfo(xslFilePath);
            var input = new FileInfo(xmlFilePath);

            // Compile stylesheet
            var processor  = new Processor();
            var compiler   = processor.NewXsltCompiler();
            var executable = compiler.Compile(new Uri(xslt.FullName));

            // Do transformation (we can use a null destination since the
            // templates use xsl:result-document tags to generate output files).
            var destination = new NullDestination();

            using (var inputStream = input.OpenRead())
            {
                var transformer = executable.Load();
                transformer.BaseOutputUri = new Uri(outputDirectory);
                transformer.SetInputStream(inputStream, new Uri(input.DirectoryName));
                transformer.Run(destination);
            }
        }
Exemplo n.º 2
0
 protected override void Because_of()
 {
     _defaultResult = Mapper.Map <DefaultSource, DefaultDestination>(new DefaultSource());
     _nullResult    = Mapper.Map <NullSource, NullDestination>(new NullSource());
 }