Our virtual home

Fighting XslTransform

Yesterday it took me several hours to figure out how to get XslTransform work with output-escaping. I had thought, it should not be a problem to implement it based on my experiences with our intranet app. It uses .asp to get some xml from a BL Layer and transform it using the MSXML Parser and some xslt. There I can transform a DOM and get back a DOM and output-escaping is not a problem. Now moved it up to .NET XslTransform it does not work this way. Thanks to Prajakta Joshi [@microsoft.com] 's post I have learned to use a Stream as output, then read the stream back with StreamReader to get the string I need. Has that to be?

» Similar Posts

  1. It's a hack?
  2. Just received: XBox 360
  3. Strange XSL Transform Exception - figured out

» Comments

  • Joshua Allen avatar

    Hi Torsten,

    I think it's just a trade-off -- when you output XML through the XmlWriter.WriteString() we assume you really want it to be text and not XML.On the other hand, we *could* have made disable-output-escaping simply map to XmlWriter.WriteRaw(), but that probably isn't exactly what you wanted.For example, suppose you write out something like "<foo xmlns:bar='zzz'>" -- WriteRaw isn't going to complain or realize that namespace scope has changed, which defeats the purpose of using XmlWriter (you might as well use a StreamWriter at that point).

    IMO, when people use disable-output-escaping, they are really just asking for something like XmlWriter.WriteXml(), which lets you pass in XML string to be parsed and then re-written to the writer (while maintaining namespace scope, etc.)Unfortunately the writer doesn't have any such capability today and no solid plans to enable it.

    Regards,
    Joshua
    XmlWriter PM

    Joshua Allen — Juni 4, 2003 9:04
  • Comments are closed