[xsl] Understanding xmlns declaration and encoding

Subject: [xsl] Understanding xmlns declaration and encoding
From: karl@xxxxxxxxxxxxxxxxxxxx
Date: Wed, 8 Sep 2004 09:35:03 -0600 (CST)
Hello,

We are/were having troubles with the final encoding of our stylesheets. 
The end result is always UTF-16, which causes some issues on MACS.  I did
come up with a solution and that was to add the following declaration to
our stylesheets:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
version="1.0" xmlns="http://www.w3.org/1999/xhtml";>

This use to be written as:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl";>

Most of our code is pre XSLT1.0 standards and in fact there are many cases
where we are still using the "order-by" property for an apply-templates
rule.

Before the above fix, I tried the following:
- made sure the XML source was UTF-8 encoded
- added the UTF-8 encoding to the output rule for the stylesheet
- manually added meta content type = UTF-8 to the head of the stylesheet
(which would result in a duplication of this tag)

This fix, it basically removes any meta tag content type declerations,
unless I explicitly put one there, where as before MSXML was throwing in
their own - the UTF-16 encoding, which is a problem for me.

The resulting HTML tag looks like this:
<HTML xmlns="http://www.w3.org/1999/xhtml";>

And in an effort to make sure I understood what exactly was fixing the
automatic insertion of the meta tag content-type UTF-16 into my HEAD, I
removed all of the above fixes and narrowed it down to to the new
namespace decleration: xmlns="http://www.w3.org/1999/xhtml";.

Can someone shed some light on all of this?  Is this all normal behaviour?
 My suggested *fix* above, is this the best way / most standard way to
write my xsl:stylesheet rule for intendid HTML output?

Thanks,

Karl

Current Thread