Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Wrox Announcements and Feedback > All Other Wrox Books
| Search | Today's Posts | Mark Forums Read
All Other Wrox Books Do you have a question about a Wrox book that isn't listed anywhere on p2p.wrox.com or where the forum is locked? Here's a forum to post questions about any other Wrox book so that other readers or one of the authors can help you with your questions. IF YOU ARE LOOKING FOR CODE DO NOT ASK "Where can I find the code for this book?" That question is answered here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the All Other Wrox Books section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old November 7th, 2003, 01:30 PM
Registered User
 
Join Date: Nov 2003
Location: Glasgow, , United Kingdom.
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Server side xsl transformation problems (ASP, IIS)


Hi guys,

I'm having problems getting a server side xsl transformation of an xml file to work. I'm using ASP with IIS to try to spit out HTML, but I'm really stuck. I think my code is ok, but I'm wondering if I've got the right parsers etc. on my machine. I must admit to being a bit lost as to what I need and where it should go. Here are short source files I've been using to attempt the transformation:
------
ASP
------
<%@ LANGUAGE=JScript %>
<html>
<head></head>
<body>
<%
var sourceFile = Server.MapPath("data.xml");
var styleFile = Server.MapPath("data.xsl");

var source = Server.CreateObject("MSXML2.DOMDocument");
var style = Server.CreateObject("MSXML2.DOMDocument");

//var source = new ActiveXObject("Msxml2.DOMDocument.4.0");
//var style = new ActiveXObject("Msxml2.DOMDocument.4.0");

source.async = false;
source.resolveExternals = false;
source.load(sourceFile);

style.async = false;
style.resolveExternals = false;
style.load(styleFile);


Response.Write(source.transformNode(style));

%>

</body>
</html>
------
XSL
------
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="uri:xsl">
<xsl:template match="/">

<table>
<tr>
<td>Title</td>
<td>Author</td>
</tr>

<xsl:for-each select="CATALOG/BOOK">
<tr>
<xsl:apply-templates/>
</tr>
</xsl:for-each>
</table>
</xsl:template>

<xsl:template match="BOOK">
    <td><xsl:value-of select="TITLE"/></td>
    <td><xsl:value-of select="AUTHOR"/></td>
</xsl:template>
</xsl:stylesheet>
------
XML
------
<?xml version="1.0"?>
<CATALOG>
<BOOK>
<TITLE>Introduction to talking shy</TITLE>
<AUTHOR>John Crop</AUTHOR>
</BOOK>

<BOOK>
<TITLE>Introduction to walking</TITLE>
<AUTHOR>John Walk</AUTHOR>
</BOOK>

<BOOK>
<TITLE>Introduction to eating crisps</TITLE>
<AUTHOR>John Fug</AUTHOR>
</BOOK>

<BOOK>
<TITLE>Introduction to smelling like a dog</TITLE>
<AUTHOR>John Acs</AUTHOR>
</BOOK>

</CATALOG>
------
The output is simply the unformatted table headings: "Title Author"

I'd appreciate any tips you might have!

Thanks-
K


Similar Threads
Thread Thread Starter Forum Replies Last Post
Server Side Viewstate in ASP.NET 2.0 vikaspatyal ASP.NET 2.0 Professional 1 December 18th, 2007 12:26 AM
Help with asp server side validation nkodali Classic ASP Basics 0 July 16th, 2007 04:02 PM
Server side transformation with- XSL/XML, ASP, IIS kenneth02 Classic ASP XML 3 November 10th, 2003 10:14 AM
ASP.NET server side controls me_shriram VS.NET 2002/2003 3 August 11th, 2003 03:55 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.