xslt transformation, where is charset=UTF-16 coming from?

E

Eric

Hello,

I have the following xml:

<?xml-stylesheet type="text/xsl" href="C:\mypath\myxsl.xsl"?>
<page>
<appl>
<datedisplay>mm/dd/yy</datedisplay>
</appl>
<forms>
<showall>False</showall>
</forms>
</page>

My xsl looks like:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="2.0">
<xsl:template match="/">
<xsl:variable name="nTabNumber">6</xsl:variable>
<html>
<head>
<SCRIPT LANGUAGE="JAVASCRIPT" />
</head>
<body></body>
</html>
</xsl:template>
</xsl:stylesheet>

I've pared both of these down from much larger files. With the larger
files I was getting an error message similar to:

XML Error Loading 'file:///d:/mypath/myxsl.xsl'
Switch from current encoding to specified encoding not supported.

at line 1, character 40"<?xml version="1.0" encoding="UTF-8" ?>"


When stepping through the larger file (and the examples I have above)
in XML Spy, I see the characterset getting changed to UTF-16, but I
don't understand why, I see the html produced by the above
transformation as:

<html><head> <META http-equiv="Content-Type" content="text/html;
charset=UTF-16"><SCRIPT></SCRIPT></head></html>

The charset=UTF-16 line appears when I'm stepping over the <SCRIPT
LANGUAGE="JAVASCRIPT" /> tag in XML Spy, does anyone know why?

Thanks,
Eric
 
A

Andy Dingley

Eric said:
When stepping through the larger file (and the examples I have above)
in XML Spy, I see the characterset getting changed to UTF-16, but I
don't understand why,

It comes out of your XSL transformation engine, which could be whatever
you've configured XML Spy to use.

Try forcing it to use UTF-8 by adding this to your stylesheet
<xsl:eek:utput encoding="utf-8" />

Good practice might even do this:
<xsl:eek:utput method="html"
encoding="utf-8"
omit-xml-declaration = "yes"
standalone = "yes"
doctype-public = "-//W3C//DTD HTML 4.01 Strict//EN"
doctype-system = "http://www.w3.org/TR/html4/strict.dtd"
cdata-section-elements = "script pre"
indent = "yes"
media-type = "text/html" />
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,736
Latest member
AdolphBig6

Latest Threads

Top