This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Loosing encoding information


> From: owner-xsl-list@lists.mulberrytech.com
> [mailto:owner-xsl-list@lists.mulberrytech.com]On Behalf Of Ragulf
> Pickaxe
> Sent: Wednesday, February 20, 2002 2:55 PM
> To: xsl-list@lists.mulberrytech.com
> Subject: [xsl] Loosing encoding information
>
>
> Hello again,
> Hopefully not problem but question (whether it is a problem for
> me depends
> on the answers to my question :)
>
> Julian Reschke:
> > > Set oXml = Server.CreateObject("MSXML2.DOMDocument")
> > > Set oXsl = Server.CreateObject("MSXML2.DOMDocument")
> > >
> > > call oXml.loadXML(vXmlData)
> > > call oXsl.load(Server.MapPath(".\Stylesheets\File.xsl"))
> > >
> > > sData=oXml.transformNode(oXsl)
> > > Response.Write(sData)
> >
> >Never do that. You'll loose encoding information.
> >
> >Use
> >
> >	oXml.transformNode(oXsl, Response)
> >
> >instead.
> >
> >And complain to MSDN about their faulty examples.
> >
>
> I have never heard of this, loosing encoding information before,
> and I use
> this code all over when transforming my documents. Can you (or

Did you ever have content with non-ASCII or non-ISO-8859-* characters?

> anyone else)
> please explain to me what exactly I am loosing? (When I say encoding, I
> strongly presume that you don't mean the character encoding as in the
> problem I had, but in a broader way...?)

If your response object happens to use a non-Unicode encoding, the XML
you're writing to will be malformed (it doesn't declare it's encoding, yet
it contains non-ASCII characters).

> Insidently, I looked up w3shool.com, looking for examples of the "right"
> way, and they showed (transforming on the client):
> ..
> document.write(xml.transformNode(xsl))
>
> Which is not exactly the same as Julian Reschke's example, but doesn't
> convert it into a string, before output, either.

This is somehow different, because you're writing to a document (HTML DOM),
not a response object (which wraps a byte stream).


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]