﻿<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
        <xsl:output method="html" indent="yes" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" />
        <xsl:variable name="title" select="/rss/channel/title"/>
        <xsl:variable name="description" select="/rss/channel/description"/>
        <xsl:variable name="feedUrl" select="/rss/channel/atom10:link[@rel='self']/@href" xmlns:atom10="http://www.w3.org/2005/Atom"/>
        <xsl:template match="/">
        <xsl:element name="html">
                <head>
                 <title>
                        <xsl:value-of select="$title"/> - RSS2.0 Feeds by Easun Studio</title>

                        <link rel="stylesheet" href="http://easun.org/images/blog.css" type="text/css"/>
                        <link rel="alternate" type="application/rss+xml" title="RSS" href="{$feedUrl}" />
                        <xsl:element name="script">
                          <xsl:attribute name="type">text/javascript</xsl:attribute>
                          <xsl:attribute name="src">http://easun.org/images/xsl.js</xsl:attribute>
                        </xsl:element>
                 </head>
                        <xsl:apply-templates select="rss/channel"/>

        </xsl:element>

        </xsl:template>
        <xsl:template match="channel">
                <body class="layout-one-column individual-entry-archive" onload="go_decoding();">
                        <div id="cometestme" style="display:none;">
                        <xsl:text disable-output-escaping="yes" >&amp;amp;</xsl:text>
                        </div>

                        <div id="container">
                                <xsl:apply-templates select="image"/>
                                <div id="header">
                                        <h1><a href="{link}"><xsl:value-of select="$title"/></a></h1>
                                        <h3>RSS2.0 Feeds</h3> 
                                        <h2><xsl:value-of select="$description"/><a href="http://easun.org" title="Go to Homepage">主页</a></h2>
 <ul>
<li><a href="http://www.newsgator.com/ngs/subscriber/subext.aspx?url={$feedUrl}">NewsGator订阅</a></li>
<li><a href="http://www.bloglines.com/sub/{$feedUrl}">Blogline订阅</a></li>
<li><a href="http://www.zhuaxia.com/add_channel.php?url={$feedUrl}">抓虾订阅</a></li>
<li><a href="http://fusion.google.com/add?feedurl={$feedUrl}">Google订阅</a></li>
</ul>
                                </div>

                                <div id="content">


                   <div id="container-inner" class="pkg">
                     <div id="pagebody">
                      <div id="pagebody-inner" class="pkg">

                       <div id="alpha">
                        <div id="alpha-inner" class="pkg">


                                        <xsl:apply-templates select="item"/>

                                </div></div></div></div></div>
                                <div id="foot">
                                        <p>Copyright(C)1998-2006 <a href="http://easun.org">北京 路杨工作室</a> , All Rights Reserved</p>

                                </div>
                        </div></div>
                </body>

        </xsl:template>

        <xsl:template match="item">
                <xsl:if test="position() = 1">
                        <h1 xmlns="http://www.w3.org/1999/xhtml">这里是<xsl:value-of select="$title"/>的RSS feeds,建议您用专门的 Feed 阅读器阅读(推荐使用<a href="http://www.curiostudio.com/download.html">GreatNews</a>)。</h1>
                </xsl:if>

                <div class="entry">
                   <h3 xmlns="http://www.w3.org/1999/xhtml" class="entry-header">
                                <a href="{link}">
                                        <xsl:value-of select="title"/>
                                </a>
                   </h3>
                 <div class="entry-content">
                   <h4 xmlns="http://www.w3.org/1999/xhtml">
                    <xsl:value-of select="substring(pubDate,5)"/>
                   </h4>
                   <div class="entry-body" id="decodeable" name="decodeable">
                          
			  <xsl:call-template name="outputContent"/>
                   </div>
                </div>
               </div>




        </xsl:template>

        <xsl:template match="image">
                <xsl:element name="img" namespace="http://www.w3.org/1999/xhtml">
                        <xsl:attribute name="src"><xsl:value-of select="url"/></xsl:attribute>
                        <xsl:attribute name="alt">Link to <xsl:value-of select="title"/></xsl:attribute>

                        <xsl:attribute name="id">feedimage</xsl:attribute>
                </xsl:element>
                <xsl:text/>
        </xsl:template>

	<xsl:template name="outputContent">
		<xsl:choose>
			<xsl:when test="xhtml:body" xmlns:xhtml="http://www.w3.org/1999/xhtml">

				<xsl:copy-of select="xhtml:body/*"/>
			</xsl:when>
			<xsl:when test="xhtml:div" xmlns:xhtml="http://www.w3.org/1999/xhtml">

				<xsl:copy-of select="xhtml:div"/>
			</xsl:when>
			<xsl:when test="content:encoded" xmlns:content="http://purl.org/rss/1.0/modules/content/">
				<xsl:value-of select="content:encoded" disable-output-escaping="yes"/>
			</xsl:when>

			<xsl:when test="description">
				<xsl:value-of select="description" disable-output-escaping="yes"/>
			</xsl:when>
		</xsl:choose>
	</xsl:template>


</xsl:stylesheet>