Attach a CSS to RSS feedTag(s): XML

Browser (ex. IE7/FF) may apply their own style when displaying a RSS Feed so even if you specify a stylesheet it will be ignored.

You add a directive to the XML file.

<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet title="XSL_formatting" type="text/xsl" href="feed.xsl"?>

<rss version="2.0">
then, in the XSL
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl=""
<xsl:template match="channel">
<link title="mystyle" href="howto.css" 
   type="text/css" rel="stylesheet"/> 
<link rel='alternate' type='application/rss+xml' 
   title="Real's HowTo" href=''/>
<title>What's new - Real's HowTo</title>
<script type="text/javascript" src="scripts/rss.js" />
.box {
    border-width: 1px 1px 1px 1px;
    border-spacing: 2px;
    border-style: solid solid solid solid;
    border-color: blue blue blue blue;
    border-collapse: separate;
    background-color: white;

<body onload="setURLS();">
<a href='' 
   title='Useful code snippets for Java, JS or PB developers!'>
  <img src='images/realhowto-left.jpg' border='0' />
<h2>What's new, the last 10 updates</h2>
<div class="box" align="center">
Copy the URL in the box below into your preferred RSS reader. 
  New content will be delivered as it's published.

<input type="text" size="50" id="rss-url"/>
<xsl:for-each select="item">
<h4><xsl:value-of select="title"/></h4>
<i><xsl:value-of select="pubDate"/></i><br/>
<xsl:value-of select="description"/><br/>
<a HREF="{link}"><xsl:value-of select="link"/></a>
<div align="center">
Written and compiled by Real Gagnon  ©1998-2007<br/>
[<A HREF="" TARGET="_top"> home </A>]
See the result.
blog comments powered by Disqus