Altova Mailing List Archives


Re: XML two pass transform

From: Martin Honnen <mahotrash@-----.-->
To: NULL
Date: 8/13/2004 2:26:00 PM

Trey Aughenbaugh wrote:

> I put your XLS in a file and ran a transforamtion on it from ASP and I
> get this message..
> 
> Switch from current encoding to specified encoding not supported.
> Error processing resource 'http://localhost/xmlTests/Home.asp'. Line
> 1, Position 40
> 
> <?xml version="1.0" encoding="UTF-16"?><rowset><rows><invited>YES</invited><close_time></close_time><Location>HOME</Location></rows><rows><invited>YES</invited><close_time></close_time><Location>AUNT</Location></rows><rows><invited>YES</invited><close_time></close_time><Location>BROTHER</Location></rows></rowset>
> ---------------------------------------^
> 
> What is really odd, I added '<?xml version="1.0" encoding="UTF-8"?>'
> to the top of the XML file..  Where is it getting UTF-16 from?
> I also closed out my browser and opened another one.
> 
> Thought that was kind of odd.  My other XML/XSL files don't have that
> problem.
> 
> I'm using this to transform the data....
> 
> <%@LANGUAGE="VBSCRIPT"%>
> <%
> 'Load XML
> set xml = Server.CreateObject("Microsoft.XMLDOM")

Consider using "Msxml2.DOMDocument.3.0" or "Msxml2.DOMDocument.4.0", 
depending on what MSXML version you have installed.

> xml.async = false
> xml.load(Server.MapPath("Home.xml"))
> 
> 'Load XSL
> set xsl = Server.CreateObject("Microsoft.XMLDOM")
> xsl.async = false
> xsl.load(Server.MapPath("Home.xsl"))
> 
> 'Transform file
> Response.Write(xml.transformNode(xsl))
> %> 

I think the problem is to Response.Write the result of transformNode, 
you should use transformNodeToObject and save to the Response object e.g.

<%@ Language="VBScript" %>
<%
Option Explicit
Dim XmlDocument, XslDocument, ResultDocument
Set XmlDocument = Server.CreateObject("Microsoft.XMLDOM")
XmlDocument.async = False
XmlDocument.Load Server.MapPath("test2004081202.xml")

Set XslDocument = Server.CreateObject("Microsoft.XMLDOM")
XslDocument.async = False
XslDocument.Load Server.MapPath("test2004081201Xsl.xml")

Set ResultDocument = Server.CreateObject("Microsoft.XMLDOM")
ResultDocument.async = False


Response.ContentType = "text/xml"

XmlDocument.transformNodeToObject XslDocument, ResultDocument

ResultDocument.save Response
%>

that should solve the encoding problem I think.

-- 

	Martin Honnen
	http://JavaScript.FAQTs.com/

Disclaimer

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.