예제 #1
0
        public XsltTransformWriter(Writer writer, XmlReader xsltReader, XsltArgumentList arguments, SerializationSettings settings)
            : base(new XmlSerializationSettings(settings), TextCase.CamelCase)
        {
            this.arguments = arguments;

            this.transformation = () => TransformAndWrite(writer, xsltReader);
            this.completeAction = () => { writer.WriteComplete(); };
            this.closeAction    = () => { writer.Close(); xsltReader.Close(); };
            this.flushAction    = () => { writer.Flush(); };

            this.buffer       = new MemoryStream();
            this.bufferWriter = new XmlDocumentWriter(new StreamWriter(this.buffer)
            {
                AutoFlush = true
            }, settings);
        }
예제 #2
0
        private Reader Transform(XmlDocumentReader documentReader, XmlReader xsltReader)
        {
            var memory = new MemoryStream();
            var writer = new StreamWriter(memory)
            {
                AutoFlush = true
            };
            var reader = new StreamReader(memory);

            var xmlWriter = new XmlDocumentWriter(writer, null);

            documentReader.CopyTo(xmlWriter);
            memory.Position = 0;

            var xmlReader = XmlReader.Create(reader);

            return(Transform(xmlReader, xsltReader));
        }