|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: MSXML2 and encoding
Hi > -----Original Message----- > From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx > [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of > Teresa Rippeon > Sent: Tuesday, August 19, 2003 9:44 PM > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > Subject: MSXML2 and encoding > > > > Whenever I tranform one XML file to another using MSXML2, I You are not using MSXML2 but MSXML3. the object name is MSXML2 but the version is not Besides MSXML2 doesn't support xslt > get the XML processing instruction with an encoding value of > "UTF-16" ( <?xml version="1.0" encoding = "UTF-16">). Of > course, then when the file is launched in IE 6, I get the > error that it can't switch to the specified encoding. I > really just want either no encoding specified or encoding = > "UTF-8". I've even tried specifying an encoding of "UTF-8". > Any advice? > > Here's the beginning of my stylesheet: > > <?xml version="1.0" encoding="UTF-8"?> > <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 indent="yes" media-type="xml" > encoding="UTF-8"></xsl:output> > > > And here's the VB code for using MSXML2, if that helps... > > 'Load the XML data > Set source_xml = New MSXML2.DOMDocument30 Here you define the version you are using. DOMDocument30 is MSXML3 > source_xml.async = False > source_xml.Load (source_doc) > If (source_xml.parseError.errorCode <> 0) Then > GoTo Errorhandling > End If > > 'Load the stylesheet > Set tranform_stylesheet = New MSXML2.DOMDocument30 > tranform_stylesheet.async = False > tranform_stylesheet.Load (stylesheet_doc) > If (tranform_stylesheet.parseError.errorCode <> 0) Then > GoTo Errorhandling > End If > > new_xml_string = source_xml.transformNode(tranform_stylesheet) Here lies your problem. You are setting the result of your transformation to a string variable. In this way you always get encoding="utf-16", the encoding used by strings in VB You need to use transformNodeToObject method and serialize the transformation to a stream. If you are doing this on the server in an asp page you can serialize directly to the response object like: source_xml.transformNodeToObject(transform_stylesheet, Response) Regards, Americo Albuquerque XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








