xsl-list
[Top] [All Lists]

Re: Perl workaround for XSLT escaped UTF-8 pass-thru to XHTML

2003-03-22 00:05:39
Gan Uesli Starling wrote:
  <xsl:output method="html"/>

Because you did not specify a preferred encoding for output, (e.g. 
<xsl:output
method="html" encoding="UTF-8"/>), MSXML is going to default to UTF-16.

Okay, I tried that. Did not work for me. Am not using MS-anything for
XSLT here but Apache Xalan on a NetBSD Unix box. Result of doing
as you suggest with my tools is here...

I'm sorry; I thought you said you were using MSXML.
I must have confused your message with someone else's.

Further, since in your example you are invoking the transformation via an
xml-stylesheet PI

I'm not sure what you mean by 'PI' but the rest makes sense.

Processing instruction, e.g.
  <?foo bar?>
  <?target instruction?>
  <?xml-stylesheet ...?>

Hm, you keep saying 'META' tag versus 'meta' tag. My understanding was
that XHTML required all lower-case tags.

You are not producing XHTML; you are producing HTML. Remember the <xsl:output
method="html"/>? If you want to produce XHTML you need to use method="xml" and
then yes, you will have to insert the meta yourself, and it'll have to be
lowercase (to be valid XHTML, anyway).

Java Xalan appears to issue no such tag. Having found none is why I hard
coded it.

Xalan does too generate the meta tag when serializing HTML. I just tried it
(Xalan-J 2.4.1). You can turn it off with xalan:omit-meta-tag="yes" in either
xsl:output or in a property file. See
http://xml.apache.org/xalan-j/usagepatterns.html#outputprops Perhaps your copy
of Xalan is either very old or has been modified to not emit the tag.

(re: the JavaScript)
Looks interesting. Appears to be somewhat MS-specific. Suppose
I could tweak it for a more broad-spectrum report?

Yes, it's MS-specific; the encoding info is not available in the standard DOM,
which is reasonable since the DOM is supposed to reflect the structures
implied by the markup, rather than the lexical details of the markup itself
(though there are exceptions to this). Anyway, at the time I made it, Mozilla
wasn't stable enough to run on any of my machines, so I never bothered to
research whether there is an equivalent in Mozilla (or Galeon or anything else).
Please let me know off-list if you come up with something more useful.

Mike

-- 
  Mike J. Brown   |  http://skew.org/~mike/resume/
  Denver, CO, USA |  http://skew.org/xml/

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list