473,473 Members | 2,097 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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

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

Dec 27 '06 #1
1 6224

Eric wrote:
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:output encoding="utf-8" />

Good practice might even do this:
<xsl:output 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" />

Dec 27 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Lakshmi Narayanan | last post by:
Hi experts, My problem is, for password <input name="password" type="password"> element the size given is 20. For another one <input name="username"> is also 20. But in browser the size differs...
2
by: Iain | last post by:
Hey folks, I've got a problem with an XML to HTML transformation that is now bugging the heck out of me. Basically, all of the entities used in my transformation style sheet are being rendered...
2
by: Bob | last post by:
I am having problems turning my xml into html for display. A sample xml file is given below, followed by my pathetic xslt attempt to transform it into html. A textual representation of what I was...
3
by: petermichaux | last post by:
Hi, I would like to know if I'm linking a CSS file in and XSLT file the most efficient way. Below is how I'm doing it. Also how can I make it so that the resulting XHTML file will be encoded...
23
by: lawrence | last post by:
I'd love to ask why this page is not rendering correctly in Safari on a Macintosh but I suspect someone will tell me to validate the page first. Nevertheless, if anyone sees an obvious reason that...
1
by: stevelooking41 | last post by:
Can someone explain why I don't seem unable to use document.write to produce a valid UTF-8 none breaking space sequence (Hex: C2A0) ? I've tried everyway I've been able to find to tell the...
1
by: theoryboy | last post by:
I'm not sure if this is the right group for this question. It seems to span a few topics. I have a PHP page that generates XML output. I want to push this output through a stylesheet...
1
by: Jesús Bosch | last post by:
I get this error after trying to call a method in a webeservice. This webservice returns an html page (as string), but I recieve this error. Someone knows a solution for this? Thanks! Jesús...
0
by: R | last post by:
Hi All, I've run into very disturbing problem, I must use html tags inside one of my XML node so I wrote: $cdataHelp = $DomDocument->createCDATASection($value); when I dump it as XML
11
by: ianoble | last post by:
I've been trying to piece together various code snippets to create a lookup table inside my xslt without the need for a supplemental xml file. Here is what I have so far. As of now, it does not...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.