<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method='html' version='1.0' encoding='UTF-8' indent='yes'/>

<xsl:template match="/">
	<html>
	<head>
		<title>RSSFeed Using XSLT</title>
	</head>
	<style type="text/css">
  		h3 {color: gray}
		a  {font-size: 14}
		a  {color: blue}
		p  {color: gray}
		p  {font-size: 10}
		div.c  {color: blue}
		div.c  {font-size: 12}
  		body {font-family: arial}
		td {
		    padding-left: 4px;
		    padding-bottom: 5px;
		    padding-top: 5px;	
		   }

		.check0 {
			 border-top: 0px blank white;
			 border-left: 0px blank white 
			}

		.check5 {
			 border-top: 0px blank white;
			 border-right: 0px blank white
			}
		
		.check6 {
			 border-top: 0px blank white;
			 border-bottom: 0px blank white
			}

		.check1 {border-bottom: 0px blank white}	
 	</style>
	<body>
		<xsl:for-each select="rss/channel">
				<h3 align="center"><xsl:value-of select="title"/></h3>
		</xsl:for-each>
		
		<table border='1' cellpadding='0'>
		<xsl:for-each select="rss/channel/item">
				<tr class='margin1'>
					<td class='check1' colspan="2">
						<xsl:element name="a">  
                        				<xsl:attribute name="href">  
                            					<xsl:value-of select=".//link"/>  
                       					</xsl:attribute>  
                         				<b><xsl:value-of select="title"/></b> 
                     				</xsl:element> 	
					</td>
				</tr>
				<tr>
					<td class='check6' colspan="2">		
						<p><b><xsl:value-of select="pubDate"/></b></p>
					</td>
				</tr>
				<tr> 
					<td class='check5' align='right'>
						<xsl:element name="img">  
	                       				<xsl:attribute name="src">  
								<xsl:value-of select=".//@url"/>        	
                       					</xsl:attribute> 
							<xsl:attribute name="height">  
							      <xsl:value-of select="100"/>                 	
                       					</xsl:attribute>
							<xsl:attribute name="depth">  
							      <xsl:value-of select=".//@height"/>                 	
                       					</xsl:attribute>
							<xsl:attribute name="width">  
							      <xsl:value-of select="100"/>                 	
                       					</xsl:attribute>
							<xsl:attribute name="contentdepth">  
							      <xsl:value-of select=".//@height"/>                 	
                       					</xsl:attribute>
							<xsl:attribute name="contentwidth">  
							      <xsl:value-of select=".//@width"/>                 	
                       					</xsl:attribute>
							<xsl:attribute name="alt">  
							<xsl:variable name="substringToHighlight1" select="'alt=&quot;'"/>
							<xsl:variable name="substringToHighlight2" select="'&quot;'"/>
								<xsl:if test="contains(.,$substringToHighlight1)">
		<xsl:value-of select="substring-before(substring-after(.,$substringToHighlight1), $substringToHighlight2)"/>
						</xsl:if>       
								              	
                       					</xsl:attribute>
                     				</xsl:element> 
					</td>
					<td class='check0' valign='top'>
						<div class='c'>
						<xsl:variable name="substringToHighlight" select="'/a&gt;'"/>
						<xsl:variable name="substringToHighlighta" select="'&lt;'"/>
						<xsl:choose>
							
  							<xsl:when test="contains(.,$substringToHighlight)">
   		<xsl:value-of select="substring-before(substring-after(.,$substringToHighlight), $substringToHighlighta)"/>
   							<xsl:text>&#10;</xsl:text>
  							</xsl:when>
  							<xsl:otherwise>
   								<xsl:value-of select="description"/> 
  							</xsl:otherwise>
 						</xsl:choose>
						</div>
					</td>
				</tr>
		</xsl:for-each>
		</table>		
	</body>
	</html>
</xsl:template>				
</xsl:stylesheet>

