Hi everyone,
I have an RSS feed coming to my site. I don't like the way it looks and want to change it, unfortunately I know nothing about XSL or XML in order to make these changes. Its pretty basic stuff from what I noticed of other threads on this forum, so if someone can be so kind as to help me fix this I would be so greatful.
Here is what the feed looks like right now;
www.thecgn.com/store/test.asp
Here is what I want it to look like;
www.thecgn.com/store/test2.asp
Here are all the files I am using currently, as well as the table from the page design I like. Please help me convert my XSL to match this.
Here is the XSL;
Code:
<?xml version="1.0" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" omit-xml-declaration="yes" indent="no"/>
<xsl:template match="*">
<table border="1" width="100%" align="center">
<tr><td valign="top" align="center" class="title" bgcolor="black" >
<a>
<xsl:attribute name="href">
<xsl:value-of select="*[local-name()='channel']/*[local-name()='link']"/>
</xsl:attribute>
<xsl:attribute name="target">
<xsl:text>top</xsl:text>
</xsl:attribute>
<xsl:value-of select="*[local-name()='channel']/*[local-name()='title']"/>
</a>
<xsl:text disable-output-escaping="yes"> </xsl:text>
<xsl:value-of select="*[local-name()='channel']/*[local-name()='lastBuildDate']"/>
</td></tr>
<tr><td valign="top" bgcolor="white" class="headlines" >
<ul>
<xsl:for-each select="//*[local-name()='item']">
<li>
<a>
<xsl:attribute name="href">
<xsl:value-of select="*[local-name()='link']"/>
</xsl:attribute>
<xsl:attribute name="target">
<xsl:text>top</xsl:text>
</xsl:attribute>
<div style="text-weight:bold;text-decoration:underline;color:#0465B2"><xsl:value-of select="*[local-name()='title']"/></div>
</a>
<div style="text-weight:normal;color:#333333"><xsl:value-of select="*[local-name()='description']" disable-output-escaping="yes"/></div>
</li>
</xsl:for-each>
</ul>
</td></tr>
</table>
</xsl:template>
<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>
</xsl:stylesheet>
Here is the ASP page;
Code:
<%
Function getXML(sourceFile)
dim styleFile
dim source, style
styleFile = Server.MapPath("news.xsl")
Dim xmlhttp
Set xmlhttp = Server.CreateObject("Microsoft.XMLHTTP")
xmlhttp.Open "GET", sourceFile, false
xmlhttp.Send
set source = Server.CreateObject("Microsoft.XMLDOM")
source.async = false
source.loadxml(xmlhttp.ResponseText)
set style = Server.CreateObject("Microsoft.XMLDOM")
style.async = false
style.load(styleFile)
getXML = source.transformNode(style)
set source = nothing
set style = nothing
End Function
%>
<%= getXML("http://www.csmonitor.com/rss/top.rss") %>
<%= getXML("http://www.csmonitor.com/rss/world.rss") %>
Here is the unedittable XML file from the external location;
Code:
<?xml version="1.0" ?>
- <rss version="0.91">
- <channel>
<title>Christian Science Monitor | Top Stories</title>
<language>en-us</language>
<copyright>Copyright 2003 The Christian Science Monitor. All rights reserved. This RSS file is offered to individuals and non-commercial organizations only. Newspapers, magazines, and other commercial websites wishing to use Monitor RSS files, please contact syndication@csmonitor.com.</copyright>
<managingEditor>feedback@csmonitor.com</managingEditor>
<webMaster>feedback@csmonitor.com</webMaster>
<description>Read the front page stories of csmonitor.com.</description>
<link>http://csmonitor.com</link>
- <image>
<title>Christian Science Monitor</title>
<url>http://www.csmonitor.com/images/logo_88x31.gif</url>
<link>http://csmonitor.com</link>
<width>88</width>
<height>31</height>
</image>
- <item>
<title>Political shoals of the swift-boat wars</title>
<description>New accusations draw out debate over Kerry's service in Vietnam - and may be an acid test of his defenses.</description>
<link>http://www.csmonitor.com/2004/0823/p01s01-uspo.html</link>
</item>
- <item>
<title>Najaf police: a thin blue line between foes</title>
<description>The standoff near the Shrine of Ali leaves Iraqi police with few allies.</description>
<link>http://www.csmonitor.com/2004/0823/p01s03-woiq.html</link>
</item>
- <item>
<title>Google's debut in the stock market sends a mixed signal</title>
<description>Google Inc.'s public stock offering is a reminder of the perils and promise of the high-tech IPO market.</description>
<link>http://www.csmonitor.com/2004/0823/p02s01-usec.html</link>
</item>
- <item>
<title>New Afghan Army asserts itself</title>
<description>Rivals in western Afghanistan agreed to a cease-fire last week after the arrival of the Afghan National Army.</description>
<link>http://www.csmonitor.com/2004/0823/p06s01-wosc.html</link>
</item>
- <item>
<title>The great Olympic beach bash</title>
<description>Buoyed by legions of young fans, beach volleyball is one of the few events to sell out night after night.</description>
<link>http://www.csmonitor.com/2004/0823/p01s02-woeu.html</link>
</item>
</channel>
</rss>
And lastly here is the HTML formatting of the way I want it to look;
Code:
<table width="424" cellpadding="2" cellspacing="0" border="1" cols="2">
<tr>
<td width="212" bgcolor="#000000" align="center" height="23">
<font color="#FFFFFF" face="Arial, Helvetica, sans-serif"><a href="#"><strong>World
News</strong></a></font>
</td>
<td width="212" bgcolor="#000000" align="center" height="23">
<font color="#FFFFFF" face="Arial, Helvetica, sans-serif"><a href="#"><strong>Canada
News</strong></a></font>
</td>
</tr>
<tr>
<td width="216">
<font color="#000000" face="Arial, Helvetica, sans-serif">
<a href="#" class="menu2">Headline #1</a><br>
Description. Description. Description. Description. Description. <br><br>
<a href="#" class="menu2">Headline #2</a><br>
Description. Description. Description. Description. Description.<br><br>
<a href="#" class="menu2">Headline #3</a><br>
Description. Description. Description. Description. Description.<br><br>
<a href="#" class="menu2">Headline #4</a><br>
Description. Description. Description. Description. Description. <br><br>
<a href="#" class="menu2">Headline #5</a><br>
Description. Description. Description. Description. Description. <br>
</font>
</td>
<td width="216">
<font color="#000000" face="Arial, Helvetica, sans-serif">
<a href="#" class="menu2">Headline #1</a><br>
Description. Description. Description. Description. Description. <br><br>
<a href="#" class="menu2">Headline #2</a><br>
Description. Description. Description. Description. Description.<br><br>
<a href="#" class="menu2">Headline #3</a><br>
Description. Description. Description. Description. Description.<br><br>
<a href="#" class="menu2">Headline #4</a><br>
Description. Description. Description. Description. Description. <br><br>
<a href="#" class="menu2">Headline #5</a><br>
Description. Description. Description. Description. Description. <br>
</font>
</td>
</tr>
</table>
Thanks for the help in advance