<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:output indent ="yes" method="html"/>	
	<xsl:template match="/">
	<table cellPadding="3">
		<TR>
			<TD>
			<xsl:apply-templates>
			<xsl:sort select="newsitem/posted"/>
			</xsl:apply-templates>
			<p></p>
			</TD>
		</TR>
	</table>
	<br/><a href="/xml/news.xml" target="_blank">View the XML</a>
	<br/><a href="/xml/news.xslt" target="_blank">View the XSLT</a>  							
	</xsl:template>
	
	<xsl:template match="newsitem">
		<xsl:param name="date"/>
		<xsl:variable name="url" select="title/@href"/>
		<xsl:variable name="expiration" select="number(concat(
  substring(@expiration, 1, 4), substring(@expiration, 6,2), substring(@expiration,9,2)))"/>
		<xsl:variable name="today" select="number(concat(
  substring($date, 1, 4), substring($date, 6,2), substring($date,9,2)))"/>
		<xsl:if test="$expiration >$today ">
			<H2><A href="{$url}"><xsl:value-of select="title"/></A></H2>
			<P><xsl:value-of select="news"/></P>
		</xsl:if>
						
	</xsl:template>	
</xsl:stylesheet>

  
