Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > Classic ASP XML
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Classic ASP XML Using ASP 3 and XML. See also the XML category for more XML discussions not relating to ASP. NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP XML section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old August 2nd, 2007, 12:23 PM
Banned
Points: 1,561, Level: 16
Points: 1,561, Level: 16 Points: 1,561, Level: 16 Points: 1,561, Level: 16
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2005
Location: , , .
Posts: 317
Thanks: 0
Thanked 0 Times in 0 Posts
Default XML/XSLT Transform Error in ASP

I'm in the process of migrating my site from classic ASP to ASP.NET 2.0, but I need to use some of the classic ASP apps until this process is complete. I'm trying to use a XML/XSLT transformation within an ASP doc (w/JScript syntax), but I'm getting an error. This setup works fine in my ASP.NET page, and I know that the XSLT doc is proper, so I'm thoroughly confused. I've included code for all of the referenced pages below, and all of these files are located in the same directory on my machine. If anyone can let me know what I'm doing wrong, that would be great. Thanks.

xmldoc.xml:
<?xml version="1.0" encoding="UTF-8"?>
<xmldoc>

    <section>
        <title>Page 1</title>
        <url>page1.asp</url>
    </section>

    <section>
        <title>Page 2</title>
        <url>page2.asp</url>
    </section>

</xmldoc>

xsldoc.xsl:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" encoding="UTF-8" indent="yes"/>
    <xsl:template match="/">
        [list]
            <xsl:for-each select="xmldoc/section">
                <li><a href="{url}"><xsl:value-of select="title" /></a></li>
            </xsl:for-each>
        </ul>
    </xsl:template>
</xsl:stylesheet>

aspdoc.asp (JScript syntax):
<%
//Load XML
var xml = Server.CreateObject("Microsoft.XMLDOM")
xml.async = false
xml.load("xmldoc.xml")

//Load XSL
var xsl = Server.CreateObject("Microsoft.XMLDOM")
xsl.async = false
xsl.load("xsldoc.xsl")

//Transform file
Response.Write(xml.transformNode(xsl))
%>

HTML output wanted:[list]
    <li><a href="page1.asp">Page 1</a></li>
    <li><a href="page2.asp">Page 2</a></li>
</ul>

Error message:
msxml3.dll error '80004005'
The stylesheet does not contain a document element. The stylesheet may be empty, or it may not be a well-formed XML document.

KWilliams
Reply With Quote
  #2 (permalink)  
Old August 22nd, 2007, 10:57 PM
Registered User
 
Join Date: Aug 2007
Location: Hanalei, HI, USA.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi KWilliams,

I know this is off topic, but did you ever find a solution to your "CSS 100% Height DIV Problem" located at:

http://p2p.wrox.com/topic.asp?TOPIC_ID=62110
Reply With Quote
  #3 (permalink)  
Old October 9th, 2007, 03:26 AM
Authorized User
 
Join Date: Oct 2007
Location: Everett, WA, USA.
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Try using the following code: (note the use of Server.MapPath())

VBScript
Code:
set xml = Server.CreateObject("Microsoft.XMLDOM")
xml.async = false
xml.load(Server.MapPath("xmldoc.xml"))

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

Response.Write(xml.transformNode(xsl))

set xsl = nothing
set xml = nothing
JScript

Code:
//Load XML
var xml = Server.CreateObject("Microsoft.XMLDOM");
xml.async = false;
xml.load(Server.MapPath("xmldoc.xml"));

//Load XSL
var xsl = Server.CreateObject("Microsoft.XMLDOM");
xsl.async = false;
xsl.load(Server.MapPath("xsldoc.xsl"));

//Transform file
Response.Write(xml.transformNode(xsl));

xsl = null;
xml = null;

Hope that helps. :)


-Charles Forsyth

Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Transform SQL server 2005 XML with xslt bonekrusher XSLT 0 July 11th, 2007 08:45 PM
How do I transform XSLT without the <?xml?> tag? nadavvin XSLT 4 June 10th, 2007 10:25 AM
Can 1 xslt transform an xml doc into 2 text files Raju Sarode XSLT 7 November 3rd, 2006 04:10 PM
Transform XML with XSLT in JavaScript Mozilla Spankmaster79 Javascript 3 January 18th, 2006 07:31 AM
XSLT read through XML to transform another XML dendenx2 XSLT 8 July 7th, 2005 09:18 PM



All times are GMT -4. The time now is 03:40 AM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.