<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:dc="http://purl.org/rss/1.0/" xmlns:fd="http://www.bradsoft.com/feeddemon/xmlns/1.0/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/">
<xsl:output method="html"/>


<xsl:variable name="common-styles">
<style type="text/css">

body {
	font-family: Comic Sans MS;
	background-color: #DEDCD8; }

div.channeltitle,
div.newsitem {
	display: inline;
	width: 410px;
	height: 410px;
	position: relative;

	border: 3px solid gray;
	margin: 20px 20px 20px 20px;
	filter: progid:DXImageTransform.Microsoft.Shadow(direction=135,strength=6);
	background-color: white; }

div.channeltitle {
	display: block;
	width: 50%;
	height: 40px;
	overflow: visible;

	padding: 10px 10px 10px 10px;
	
	font-size: 160%;
	text-align: center; }

div.readnewsitemcontent,
div.flaggednewsitemcontent,
div.newsitemcontent {
	display: block;
	overflow: auto;
	width: 370px;
	height: 320px;

	border: 1px solid gray;
	margin: 2px 20px 20px 20px;
	padding: 10px 10px 10px 10px;
	background-color: #F8F8FF;
	scrollbar-base-color: #F8F8FF;
	scrollbar-3dlight-color: gray;
	scrollbar-shadow-color: white;
	scrollbar-arrow-color: gray;
	scrollbar-face-color: #F0F0FF;

	font-size: 80%; }

div.readnewsitemcontent { 
	background-color: #DEDCD8; 
	scrollbar-base-color: #DEDCD8;
	scrollbar-face-color: #D2D0D0; }

div.flaggednewsitemcontent { 
	background-color: #FF9999; 
	scrollbar-base-color: #FF9999;
	scrollbar-face-color: #FFA0A0; }


div.newsitemtitle {
	display: block;
	overflow: visible;	
	height: 80px;

	padding: 0px 20px 20px 20px;

	font-size: 140%;
	text-align: center; }

div.newsitemdate {
	display: block;
	padding: 3px 15px 0px 15px;

	text-align: right;
	font-size: 75%;
	color: gray; }

div.newsitemdate a,
div.newsitemtitle a,
div.channeltitle a {
	text-decoration: none;
	color: black;
	font-family: Comic Sans MS; }

blockquote { 
	margin-left: 20px; 
	margin-right: 20px; }

i,
em { font-style: normal;	}

code, 
pre, 
tt { font-size: 90%; }

a { color: black; }

a:hover { color: blue; }

a img { border: 1px solid black; }

a:hover img { border: 1px solid blue; }

</style>
</xsl:variable>

<xsl:variable name="AdditionalStyles">
<style type="text/css">

div.newsitem {
	width: 615px;
	height: 615px; }

div.readnewsitemcontent,
div.flaggednewsitemcontent,
div.newsitemcontent {
	width: 570px;
	height: 480px; }

</style>
</xsl:variable>

<!-- newsitem  -->
<xsl:template match="item">
	<div class="newsitem">
		<div class="newsitemdate">
		<xsl:if test="/newspaper/@type='newsitem'">
		<!-- 
			Important: use 'source' element here so that source channel shows for 
			newsbins and watches.  For other channels, FeedDemon sets the source
			to the channel itself.
		-->
				Source: <a href="{source/@htmlUrl}">
							<xsl:value-of select="source" disable-output-escaping="yes"/>
						</a>
				|
				<a href="{source/@url}">RSS</a> |
		</xsl:if>
			<xsl:value-of select="fd:dateDisplay"/>
		</div>
		<div class="newsitemcontent">
		<xsl:if test="fd:state[@read='1']">
			<xsl:attribute name="class">readnewsitemcontent</xsl:attribute>
		</xsl:if>
		<xsl:if test="fd:state[@flagged='1']">
			<xsl:attribute name="class">flaggednewsitemcontent</xsl:attribute>
		</xsl:if>
			<xsl:value-of select="description" disable-output-escaping="yes"/>
		</div>
		<div class="newsitemtitle">
			<a href="{link}"  title="Click to open the newsitem's link.&#10;Hold SHIFT to open it in a new window">
				<xsl:attribute name="class"><xsl:choose><xsl:when test="fd:state[@flagged='1']">flagged</xsl:when><xsl:when test="fd:state[@read='1']">read</xsl:when></xsl:choose></xsl:attribute>
				<xsl:value-of select="title" disable-output-escaping="yes"/>
			</a>
		</div>
	</div>
</xsl:template>
<!-- channel  -->
<xsl:template match="channel">
	<center>
	<div class="channeltitle">
		<a href="{link}"  title="Click to open the channel's homepage.&#10;Hold SHIFT to open it in a new window">
			<xsl:value-of select="title"/>
		</a>
	</div>
	</center>
	<xsl:for-each select="item">
		<xsl:sort select="fd:sortKey" data-type="number" order="ascending"/>
		<xsl:apply-templates select="."/>
	</xsl:for-each>
</xsl:template>
<!-- channel/group newspaper -->
<xsl:template match="newspaper[@type='group' or @type='channel']">
	<html>
		<head>
			<title>Group/Channel Newspaper</title>
			<base href="{//channel[1]/link}" />
			<xsl:copy-of select="$common-styles"/>
		</head>
		<body>
			<xsl:for-each select="channel">
				<xsl:apply-templates select="."/>
			</xsl:for-each>
		</body>
	</html>
</xsl:template>
<!-- single news item -->
<xsl:template match="newspaper[@type='newsitem']">
	<html>
		<head>
			<title>News Item</title>
			<base href="{//item/link}" />
			<xsl:copy-of select="$common-styles"/>
			<xsl:copy-of select="$AdditionalStyles"/>
		</head>
		<body>
			<xsl:for-each select="channel/item">
				<xsl:apply-templates select="."/>
			</xsl:for-each>
		</body>
	</html>
</xsl:template>
</xsl:stylesheet>
