transforming XML to HTML using ISO-8859-1 encoding

transforming XML to HTML using ISO-8859-1 encoding

Post by Dan » Wed, 16 May 2001 17:22:08



Gidday,

I have an XML document that I wish to transform to HTML throught DOM using
an XSL document. I can produce the HTML no problem (style, layout, etc).
However, the META tag that is produced in the HTML is,

<META http-equiv="Content-Type" content="text/html; charset=UTF-16"> but I
would like it to be

<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> so
that European characters are handled correctly.

My XSL document begins as follows,

<?xml version="1.0" encoding="ISO-8859-1" ?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 xmlns:fo="http://www.w3.org/1999/XSL/Format">

<xsl:output method="html" encoding="ISO-8859-1"/>

AND my XML,

<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml:stylesheet type="text/xsl"?>

I would appreciate any help with this.

Cheers,
Dan.

 
 
 

transforming XML to HTML using ISO-8859-1 encoding

Post by Dan » Wed, 16 May 2001 17:27:10


Gidday,

I have an XML document that I wish to transform to HTML throught DOM using
an XSL document. I can produce the HTML no problem (style, layout, etc).
However, the META tag that is produced in the HTML is,

<META http-equiv="Content-Type" content="text/html; charset=UTF-16"> but I
would like it to be

<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> so
that European characters are handled correctly.

My XSL document begins as follows,

<?xml version="1.0" encoding="ISO-8859-1" ?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 xmlns:fo="http://www.w3.org/1999/XSL/Format">

<xsl:output method="html" encoding="ISO-8859-1"/>

AND my XML,

<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml:stylesheet type="text/xsl"?>

I would appreciate any help with this.

Cheers,
Dan.

 
 
 

transforming XML to HTML using ISO-8859-1 encoding

Post by b_driese » Wed, 16 May 2001 21:16:38


<xmp>

Server-Side
=========
JScript:
    XML.transformNodeToObject(XSLT,Response);
VBScript:
    XML.transformNodeToObject XSLT, Response

Client-Side
========
<script language="JScript">
//Requires MDAC 2.5 Minimum
//May have Internet Restrictions
//Better suited for Intranet and Extranets
var Stream = new ActiveXObject("ADODB.Stream")
var XML = new ActiveXObject("Msxml2.DOMDocument.3.0");
var XSLT = new ActiveXObject("Msxml2.DOMDocument.3.0");
XML.async = XSLT.async = false;
XML.load("copy.xml");
XSLT.load("copy.xsl");
with (Stream) {
 CharSet = "windows-1252";
 Open();
 XML.transformNodeToObject(XSLT, Stream);
 Position = 0;
 var szText = Stream.ReadText();
 Close;

Quote:}

var myWin = window.open("about:blank","myWin");
myWin.document.open();
myWin.document.write(szText);
myWin.document.close();
delete myWin; myWin = null;
delete XML; XML = null;
delete XSLT; XSLT = null;
delete Stream; Stream = null;
CollectGarbage();
</script>

</xmp>


> Gidday,

> I have an XML document that I wish to transform to HTML throught DOM using
> an XSL document. I can produce the HTML no problem (style, layout, etc).
> However, the META tag that is produced in the HTML is,

> <META http-equiv="Content-Type" content="text/html; charset=UTF-16"> but I
> would like it to be

> <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> so
> that European characters are handled correctly.

> My XSL document begins as follows,

> <?xml version="1.0" encoding="ISO-8859-1" ?>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>  xmlns:fo="http://www.w3.org/1999/XSL/Format">

> <xsl:output method="html" encoding="ISO-8859-1"/>

> AND my XML,

> <?xml version="1.0" encoding="ISO-8859-1"?>
> <?xml:stylesheet type="text/xsl"?>

> I would appreciate any help with this.

> Cheers,
> Dan.

 
 
 

transforming XML to HTML using ISO-8859-1 encoding

Post by Dan » Wed, 16 May 2001 22:38:59


thanks that work brilliantly, however, does anyone know how to produce the
same result without the stream object??

Cheers,
Dan.


<xmp>

Server-Side
=========
JScript:
    XML.transformNodeToObject(XSLT,Response);
VBScript:
    XML.transformNodeToObject XSLT, Response

Client-Side
========
<script language="JScript">
//Requires MDAC 2.5 Minimum
//May have Internet Restrictions
//Better suited for Intranet and Extranets
var Stream = new ActiveXObject("ADODB.Stream")
var XML = new ActiveXObject("Msxml2.DOMDocument.3.0");
var XSLT = new ActiveXObject("Msxml2.DOMDocument.3.0");
XML.async = XSLT.async = false;
XML.load("copy.xml");
XSLT.load("copy.xsl");
with (Stream) {
 CharSet = "windows-1252";
 Open();
 XML.transformNodeToObject(XSLT, Stream);
 Position = 0;
 var szText = Stream.ReadText();
 Close;

Quote:}

var myWin = window.open("about:blank","myWin");
myWin.document.open();
myWin.document.write(szText);
myWin.document.close();
delete myWin; myWin = null;
delete XML; XML = null;
delete XSLT; XSLT = null;
delete Stream; Stream = null;
CollectGarbage();
</script>

</xmp>

Quote:> Gidday,

> I have an XML document that I wish to transform to HTML throught DOM using
> an XSL document. I can produce the HTML no problem (style, layout, etc).
> However, the META tag that is produced in the HTML is,

> <META http-equiv="Content-Type" content="text/html; charset=UTF-16"> but I
> would like it to be

> <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
so
> that European characters are handled correctly.

> My XSL document begins as follows,

> <?xml version="1.0" encoding="ISO-8859-1" ?>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>  xmlns:fo="http://www.w3.org/1999/XSL/Format">

> <xsl:output method="html" encoding="ISO-8859-1"/>

> AND my XML,

> <?xml version="1.0" encoding="ISO-8859-1"?>
> <?xml:stylesheet type="text/xsl"?>

> I would appreciate any help with this.

> Cheers,
> Dan.

 
 
 

transforming XML to HTML using ISO-8859-1 encoding

Post by b_driese » Thu, 17 May 2001 00:16:18


The problem is that the transformNodeToObject sends a text stream. Only Objects that have the IStream Interface can receive the textstream. I know of no client-side DOM objects that have the IStream interface; but with MSIE6 who knows?

In short, any COM Object with the IStream Interface can be used. ADODB.Stream object is commonly used. Its footprint is small. I am sure that are a few other objects with the interface but it escapes me for the moment.


> thanks that work brilliantly, however, does anyone know how to produce the
> same result without the stream object??

> Cheers,
> Dan.



> <xmp>

> Server-Side
> =========
> JScript:
>     XML.transformNodeToObject(XSLT,Response);
> VBScript:
>     XML.transformNodeToObject XSLT, Response

> Client-Side
> ========
> <script language="JScript">
> //Requires MDAC 2.5 Minimum
> //May have Internet Restrictions
> //Better suited for Intranet and Extranets
> var Stream = new ActiveXObject("ADODB.Stream")
> var XML = new ActiveXObject("Msxml2.DOMDocument.3.0");
> var XSLT = new ActiveXObject("Msxml2.DOMDocument.3.0");
> XML.async = XSLT.async = false;
> XML.load("copy.xml");
> XSLT.load("copy.xsl");
> with (Stream) {
>  CharSet = "windows-1252";
>  Open();
>  XML.transformNodeToObject(XSLT, Stream);
>  Position = 0;
>  var szText = Stream.ReadText();
>  Close;
> }
> var myWin = window.open("about:blank","myWin");
> myWin.document.open();
> myWin.document.write(szText);
> myWin.document.close();
> delete myWin; myWin = null;
> delete XML; XML = null;
> delete XSLT; XSLT = null;
> delete Stream; Stream = null;
> CollectGarbage();
> </script>

> </xmp>


> > Gidday,

> > I have an XML document that I wish to transform to HTML throught DOM using
> > an XSL document. I can produce the HTML no problem (style, layout, etc).
> > However, the META tag that is produced in the HTML is,

> > <META http-equiv="Content-Type" content="text/html; charset=UTF-16"> but I
> > would like it to be

> > <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
> so
> > that European characters are handled correctly.

> > My XSL document begins as follows,

> > <?xml version="1.0" encoding="ISO-8859-1" ?>
> > <xsl:stylesheet version="1.0"
> > xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> >  xmlns:fo="http://www.w3.org/1999/XSL/Format">

> > <xsl:output method="html" encoding="ISO-8859-1"/>

> > AND my XML,

> > <?xml version="1.0" encoding="ISO-8859-1"?>
> > <?xml:stylesheet type="text/xsl"?>

> > I would appreciate any help with this.

> > Cheers,
> > Dan.

 
 
 

transforming XML to HTML using ISO-8859-1 encoding

Post by b_driese » Thu, 17 May 2001 03:48:39


besides of course the obvious XML.transformNodeToObject(XSLT,XMLResult) but the output must be in XML

> thanks that work brilliantly, however, does anyone know how to produce the
> same result without the stream object??

> Cheers,
> Dan.



> <xmp>

> Server-Side
> =========
> JScript:
>     XML.transformNodeToObject(XSLT,Response);
> VBScript:
>     XML.transformNodeToObject XSLT, Response

> Client-Side
> ========
> <script language="JScript">
> //Requires MDAC 2.5 Minimum
> //May have Internet Restrictions
> //Better suited for Intranet and Extranets
> var Stream = new ActiveXObject("ADODB.Stream")
> var XML = new ActiveXObject("Msxml2.DOMDocument.3.0");
> var XSLT = new ActiveXObject("Msxml2.DOMDocument.3.0");
> XML.async = XSLT.async = false;
> XML.load("copy.xml");
> XSLT.load("copy.xsl");
> with (Stream) {
>  CharSet = "windows-1252";
>  Open();
>  XML.transformNodeToObject(XSLT, Stream);
>  Position = 0;
>  var szText = Stream.ReadText();
>  Close;
> }
> var myWin = window.open("about:blank","myWin");
> myWin.document.open();
> myWin.document.write(szText);
> myWin.document.close();
> delete myWin; myWin = null;
> delete XML; XML = null;
> delete XSLT; XSLT = null;
> delete Stream; Stream = null;
> CollectGarbage();
> </script>

> </xmp>


> > Gidday,

> > I have an XML document that I wish to transform to HTML throught DOM using
> > an XSL document. I can produce the HTML no problem (style, layout, etc).
> > However, the META tag that is produced in the HTML is,

> > <META http-equiv="Content-Type" content="text/html; charset=UTF-16"> but I
> > would like it to be

> > <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
> so
> > that European characters are handled correctly.

> > My XSL document begins as follows,

> > <?xml version="1.0" encoding="ISO-8859-1" ?>
> > <xsl:stylesheet version="1.0"
> > xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> >  xmlns:fo="http://www.w3.org/1999/XSL/Format">

> > <xsl:output method="html" encoding="ISO-8859-1"/>

> > AND my XML,

> > <?xml version="1.0" encoding="ISO-8859-1"?>
> > <?xml:stylesheet type="text/xsl"?>

> > I would appreciate any help with this.

> > Cheers,
> > Dan.

 
 
 

1. how to load the iso-8859-1 encoded xml using MSXML.dll ver 2.0

hi,
  i am using the MSXML.dll version 2.0 , for parsing xml'x in vc++.
i have to use the loadxml method and not load method according to the
requirments.
so , here is the problem,
                 the loadxml method loads any xml except those with
encoding="iso-8859-1"
             when i give
                   <?xml version="1.0" ?>
                             it works but when i give the following it fails
                         <?xml version="1.0" encoding="iso-8859-1" ?>
                                       the error given is
            "switch from current encoding to specified encoding not
supported"
                      it could be because of absence of BOM(byte order mark)
or sth else.
                      could any body give a very fast and efficient work
around.
Thanks and Regards
Rahmatullah

2. WTB: Used business phone systems and parts

3. encoding="ISO-8859-1" becomes encoding="UTF-16"

4. Multiple ADSL Connections

5. Umlaute in XML / encoding="ISO-8859-1"

6. Dvips and Macintosh frustration

7. MSXML4 write XML with encoding="ISO-8859-1"

8. EMC Announcement: FDRSOS, SMTF

9. add encoding="ISO-8859-1" to the xml tag

10. XML encoding iso-8859-1

11. Umlaute in XML / encoding="ISO-8859-1"

12. encoding="ISO-8859-1" in a xsl-file

13. Error with encoding='ISO-8859-1', please help.