473,387 Members | 1,542 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

xml to html transformation fails

I'm trying to develop a system for transforming an xml file into two
different html pages via VBscript. My code fails but does not
generate any error messages. Here's my vbscript:
Set xmlDoc = Server.CreateObject("Microsoft.XMLDOM")
xmlDoc.async=false
xmlDoc.load(Server.MapPath("toc.xml"))

set xslDoc = Server.CreateObject("Microsoft.XMLDOM")
xslDoc.async = false
xslDoc.load(Server.MapPath("toc.xsl"))

If xmlDoc.parseError.errorCode = 0 Then
Response.Write(xmlDoc.transformNode(xslDoc))
Else
response.write("Your data was not found.")
End If

When IE displays the web page that contains the above script, the only
thing in the html is "<?xml version="1.0" encoding="UTF-16"?><?xml
version="1.0" encoding="UTF-16"?>."
The strange thing is that my xml files use different encoding.

I've validated both toc.xml and toc.xsl, but could there still be a
problem there? I'm not sure what to try.

Here's the DTC from toc.xml:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE toc [
<!ELEMENT toc (section+, page*)>
<!ELEMENT section (sectitle,page+,section*)>
<!ELEMENT sectitle (#PCDATA)>
<!ELEMENT page (pagurl,pagtitle)>
<!ELEMENT pagurl (#PCDATA)>
<!ELEMENT pagtitle (#PCDATA)>
]>
<toc>
....
Hope this helps.
BTW, if you feeel that this should be posted in a vbscript forum, my
apologies in advance.

Jeff
Jul 20 '05 #1
1 2180


Jeff Gutsell wrote:
I'm trying to develop a system for transforming an xml file into two
different html pages via VBscript. My code fails but does not
generate any error messages. Here's my vbscript:
Set xmlDoc = Server.CreateObject("Microsoft.XMLDOM")
xmlDoc.async=false
xmlDoc.load(Server.MapPath("toc.xml"))

set xslDoc = Server.CreateObject("Microsoft.XMLDOM")
xslDoc.async = false
xslDoc.load(Server.MapPath("toc.xsl"))

If xmlDoc.parseError.errorCode = 0 Then
Response.Write(xmlDoc.transformNode(xslDoc))
Else
response.write("Your data was not found.")
End If

When IE displays the web page that contains the above script, the only
thing in the html is "<?xml version="1.0" encoding="UTF-16"?><?xml
version="1.0" encoding="UTF-16"?>."
The strange thing is that my xml files use different encoding.


Use
xmlDoc.transformNodeToObject xslDoc, Response
and the encoding problem goes away.
Microsoft has its own newsgroups on all sort of topics, including XML
and XSLT so you might want to try there (news.microsoft.com) next time.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Prasad | last post by:
We are invoking a SQL DTS component (lets call it Comp1) built by us in another component (Comp2).Comp1 was built by creating the DTS package using the SQL DTS wizard and then saving it as a VB...
2
by: Econ | last post by:
XML as part of HTML in different browsers In one folder are few files - XML - file with data - HTML - file with static text - XSL - file for transformation XML data into HTML - CSS -...
5
by: KathyB | last post by:
If someone could just explain this to me...I just don't get it! I have an aspx page where I retrieve several session variables and use xmlDocument to transform xml file with xsl file into an...
12
by: Trevor Oakley | last post by:
I am producing HTML from XslTransform (C#) and the HTML does not validate, see http://www.redburg.co.uk/mira/mira415_ev_wh_ch.html as an example. I am using the following XSLT code: <?xml...
4
by: John Bowman | last post by:
Hi, I'm not certain this is the best place to post this, but here it goes. I'm trying to get spaces to work correctly when using the WebBrowser control. Basically, I've got a valid XML...
0
by: RussellKay | last post by:
To all who might be interested: I have created a CALS to HTML XSL transformation style sheet that converts 98% of the CALS table standard to a HTML equivalent. The XSL Version 1.0 transformation...
1
by: MORALBAROMETER | last post by:
Hi all, I want to update MULTIPLE elements of an HTML page using Ajax. for this reason i my response is an xml document. I want to use XSL at the client side to update these elements. How can i...
21
by: =?iso-8859-2?Q?K=F8i=B9tof_=AEelechovski?= | last post by:
It is common knowledge that XHTML is better HTML and you can serve XHTML content as HTML. However, the second statement is incorrect, for various reasons; it is enough to say that the HTML...
1
by: patrickbeaudoin | last post by:
Hi, I have a problem when I put the <htmltag in to a xsl transformtion. First, I give you a xml and xsl example: XML: <form title="Test" height="600" width="800"> <element type="check">...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.