Re: [xsl] MSXML / NBSP problem and resolution

Subject: Re: [xsl] MSXML / NBSP problem and resolution
From: Mike Brown <mike@xxxxxxxx>
Date: Fri, 8 Nov 2002 05:10:31 -0700 (MST)
David Carlisle wrote:
> me> No it is _mandated_ to add a meta element  by the XSLT spec.
> you> Actually, it's a "should" in the spec.
> so it is. I wonder why. (If any system can do html output at all I'd have
> thought it could easily do this)

I can think of 2 reasons why it's a should.

One is that the XSLT engine isn't necessarily encoding the output. It could
pass the HTML as Unicode to another process, which may or may not take care of
encoding it as bytes somewhere down the line. So it can't guess at what
encoding, if any, should be "declared" in the HTML document. On the other
hand, XML has the same problem, and the solution is that the processing APIs
(SAX for example) state that if the document is being received as Unicode,
then the encoding declaration is ignored, so it doesn't matter what it says.

The other more pressing reason is that if you are starting the serialization
of each node of the result tree as soon as it is added, which is what many
XSLT processors attempt to do, you have to keep state while outputting the
contents of the <head> element, in order to know whether you've reached the
end and haven't yet output a <meta http-equiv="Content-Type">. That might be
more work than the spec wants to require of an XSLT processor.

   - Mike
  mike j. brown                   |  xml/xslt:
  denver/boulder, colorado, usa   |  resume:

 XSL-List info and archive:

Current Thread