When I use the XslTransform.Transform method to write to the
HttpRequest.OutputStream The first byte of the output is always an invalid
character, looks like an ascii zero or some other non-printable ascii char.
The problem is that it messes up my display.
Here is the code:
....
Response.Write("<span>some text</span>");
XmlTextReader reader = new XmlTextReader(xslFile);
XslTransform xsl = new XslTransform();
xsl.Load(reader, resolver, evidence);
xsl.Transform(xmlDoc, args, Request.OutputStream, resolver);
HTML Output:
<span>some text</span>"invalid char"<div>Some transformed html</div>
The problem is that the output should look like this:
some text
Some transformed html
But when the html parser finds the <div> tag it notices that there is
already text on the current line (the invalid char) and starts on the next
line. This adds an extra line break that looks like this:
some text
Some transformed html
Has anyone seen this before? If so is there a fix or workaround? I would
hate to have to transform to a string and then use Response.Write() to write
out the transformation
Thanks,
Tim