XML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreXML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old August 23rd, 2004, 03:13 PM
TERM7972 TERM7972 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 1 TERM7972 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
newbie XSL formatting help needed

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

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > newbie XSL formatting help needed


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT