On May 26, 5:13*pm, Martin Honnen <mahotr...@yahoo.de> wrote:
> chris_huh wrote:
> > I've got the code like this now, and it just procudes a blank page:
>
> > <%
> > 'Load XML
> > set xml = Server.CreateObject("Microsoft.XMLDOM")
> > xml.async = false
> > xml.validateOnParse = false
> > xml.resolveExternals = false
> > xml.load(Server.MapPath("/iraq/index.shtml"))
>
> > If xml.parseError.errorCode <> 0 Then
> > Response.Write xml.parseError.reason
> > End If
>
> > 'Load XSL
> > set xsl = Server.CreateObject("Microsoft.XMLDOM")
> > xsl.async = false
> > xsl.load(Server.MapPath("/includes/topstyle.xsl"))
>
> > 'Transform file
> > Response.Write(xml.transformNode(xsl))
> > %>
>
> Well I would first debug the stylesheet in an XML editor to ensure it
> produces the output you want before running it in ASP.
> If you need help with the stylesheet then you need to share the XML
> input and the XSLT stylesheet.
>
> --
>
> * * * * Martin Honnen
> * * * *http://msmvps.com/blogs/martin_honnen/
The asp file is making the correct coding apart from the foreach
stuff.
So at the moment i have this for the ASP:
<%
'Load XML
set xml = Server.CreateObject("Microsoft.XMLDOM")
xml.async = false
xml.validateOnParse = false
xml.resolveExternals = false
xml.load(Server.MapPath("/iraq/test.shtml"))
If xml.parseError.errorCode <> 0 Then
Response.Write xml.parseError.reason
End If
'Load XSL
set xsl = Server.CreateObject("Microsoft.XMLDOM")
xsl.async = false
xsl.load(Server.MapPath("/includes/topstyle.xsl"))
'Transform file
Response.Write(xml.transformNode(xsl))
%>
This for the XSL:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns

sl="http://www.w3.org/1999/XSL/Transform">
<xsl

utput method="xml" version="1.0" encoding="UTF-8" doctype-
public="-//W3C//DTD XHTML 1.1//EN" doctype-system="http://www.w3.org/
TR/xhtml11/DTD/xhtml11.dtd" indent="yes"/>
<xsl:template match="/">
<html>
<head>
<title>Test</title>
</head>
<body>
<ul>
<xsl:for-each select="html/body/item">
<li>
<xsl:value-of select="headline" />
</li>
</xsl:for-each>
</ul>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
And this for the XHTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="EN" lang="EN">
<head>
<title>Test stories</title>
</head>
<body class="iraq">
<item>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="226" rowspan="2" valign="top"><a href="#"><img src="../
images/placeholder226.jpg" alt="Story 1" name="Story1image"
width="226" height="170" id="Story1image" /></a></td>
<td width="10" rowspan="2" valign="top"></td>
<td valign="top"><h2 class="itemheader"><a href="#"
class="itemlink"><headline>Story 1 headline</headline></a></h2></td>
</tr>
<tr>
<td valign="top" class="itemdescription">Story 1 summary</td>
</tr>
<tr>
<td height="10" colspan="3" valign="top"></td>
</tr>
</table></item>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="238" align="left" valign="top">
<item>
<table width="228" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="76" valign="top"><a href="#"><img src="../images/
placeholder66.jpg" alt="Story 2" name="Story2image" width="66"
height="49" id="Story2image" /></a></td>
<td valign="top"><h3 class="itemheader"><a href="#"
class="itemlink"><headline>Story 2 headline</headline></a></h3></td>
</tr>
<tr>
<td colspan="2" valign="top" height="10"></td>
</tr>
<tr>
<td colspan="2" valign="top" class="itemdescription">Story 2
summary</td>
</tr>
</table></item></td>
<td align="right" valign="top"><item><table width="228" border="0"
cellspacing="0" cellpadding="0">
<tr>
<td width="76" valign="top"><a href="#"><img src="../images/
placeholder66.jpg" alt="Story 3" name="Story3image" width="66"
height="49" id="Story2image2" /></a></td>
<td valign="top"><h3 class="itemheader"><a href="#"
class="itemlink"><headline>Story 3 headline</headline></a></h3></td>
</tr>
<tr>
<td colspan="2" valign="top" height="10"></td>
</tr>
<tr>
<td colspan="2" valign="top" class="itemdescription">Story 3
summary</td>
</tr>
</table></item></td>
</tr>
</table>
</body>
</html>
Obviously i want to change the XHTML to look nicer but i am just
trying to get this working. I know the ASP and XSL work because if i
use an XML file instead of XHTML it works:
<?xml version="1.0" encoding="ISO-8859-1"?>
<news>
<item><headline>Story 1 headline</headline></item>
<item><headline>Story 2 headline</headline></item>
<item><headline>Story 3 headline</headline></item>
</news>