RE: [xsl] Loosing encoding information

Subject: RE: [xsl] Loosing encoding information
From: Jeff Beadle <Jbeadle@xxxxxxxx>
Date: Wed, 20 Feb 2002 09:29:19 -0500
Hey Ragulf,

This was a bit of an enlightenment for me, I'm just glad that was on this
list when Julian had earlier posted something similar to this.

I'm sure he'll respond with much better detail than I, but the issue is
when you transform to a string you (may) lose the original encoding intent 
of the stylesheet because the string object that is getting loaded with the 
result of the transform was constructed within the character set encoding
of it's context ... for example, that of the given ASP.

I confirmed this to be the case ... not that Julian needs my validation, I 
just had to do it for my own peice of mind.

The other thing to keep in mind as well, is that if your only transforming 
a section of resultant html page, the character set encoding for the given
html page needs to be the same as that of the transformed section.  Now, I
can't say this is true with authority (hopefully others here on the list 
can) but all of the testing I've done indicates this to be true and it seems
logical to me to be this way.


-Jeff


-----Original Message-----
From: Ragulf Pickaxe [mailto:jawxml@xxxxxxxxxxx]
Sent: Wednesday, February 20, 2002 8:55 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
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 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...?)

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.

Thank you again
Ragulf Pickaxe :)

_________________________________________________________________
MSN Photos is the easiest way to share and print your photos: 
http://photos.msn.com/support/worldwide.aspx


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

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


Current Thread