⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 serif.xsl

📁 自己写的一个 RSS 阅读器
💻 XSL
字号:
<?xml version="1.0"?>

<xsl:stylesheet version="1.0"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	xmlns:fd="http://www.bradsoft.com/feeddemon/xmlns/1.0/">
<xsl:output method="html"/>
<xsl:variable name="common-styles">
	<style type="text/css">
		body { font: 85%/150% Georgia, serif; margin: 22px 30px; background-color: #fff; }
		a { color: #003399; text-decoration: none;}
		a:hover { color: #6B8ADE; text-decoration: underline; }
		span.nodescription {	font-size: x-small; color: silver;}
		div.newspapertitle { font: 140% "Trebuchet MS", Tahoma, Arial, sans-serif; font-weight: bold; text-align: left; border-bottom: 6px double #CC3380; margin-bottom: 28px; padding-bottom: 14px; }
		div.channeltitle { font-size: larger; font-weight: bold; text-transform: uppercase; margin-top: 18px; margin-bottom: 18px;}
		div.newsitemdate { font-size: xx-small; color: gray; font-style: italic; text-align: left; font-weight: normal; margin-top: 4px; margin-bottom: 4px; }
		div.newsitemcontent { border-bottom: 1px solid #99ccff;	margin-bottom: 22px; padding-bottom: 22px; }
		div.newsitemcontent ol, div.newsitemcontent ul { list-style-position: inside;}		
		div.newsitemcontent a {	text-decoration: underline; }
		div.newsitemtitle { font-weight: bold; }
		div.newsitemtitle, div.newsitemcontent, div.newsitemdate { margin-left: 24px;}
		img.channel { float: right; border: none; margin-right: 8px;}
		img {	clear: both; }
	</style>
</xsl:variable>

<!-- channel newspaper -->
<xsl:template match="channel">
	<html xmlns:m="http://www.w3.org/1998/Math/MathML">
	<head>
		<title>Channel Newspaper</title>
		<xsl:copy-of select="$common-styles"/>
	</head>
	<body>
		<div class="newspapertitle">
			<!-- channel image -->
			<xsl:if test="image">
			  <xsl:variable name="imgurl" select="image/url"/>
			  <xsl:variable name="imgtitle" select="image/title"/>
			  <xsl:variable name="imglink" select="image/link"/>
			  <a href="{$imglink}"><img class="channel" src="{$imgurl}" alt="{$imgtitle}"/></a>
			</xsl:if>
			<!-- channel title -->
			<xsl:value-of select="title" disable-output-escaping="yes"/>
		</div>
		
		<!-- loop through each news item -->
		<xsl:for-each select="item">
		   <div class="newsitemtitle">
			  <xsl:variable name="itemlink" select="link"/>
		       <a href="{$itemlink}"><xsl:value-of select="title" disable-output-escaping="yes"/></a>
			</div>
			<div class="newsitemdate"><xsl:value-of select="pubDate"/></div>
			<div class="newsitemcontent">
				<xsl:value-of select="description" disable-output-escaping="yes"/>
			</div>
  		</xsl:for-each>
		
	</body>
	</html>
</xsl:template>

<!-- single news item -->
<xsl:template match="items">
	<html xmlns:m="http://www.w3.org/1998/Math/MathML">
	<head>
		<title>News Item</title>
		<xsl:copy-of select="$common-styles"/>
		<style>
			div.newspapertitle {	margin-bottom: 14px;  }
		</style>
	</head>
	<body>
		<xsl:for-each select="item">		
		   <div class="newspapertitle">
			  <xsl:variable name="itemlink" select="link"/>
		       <a href="{$itemlink}"><xsl:value-of select="title" disable-output-escaping="yes"/></a>
			</div>
			<div class="newsitemdate"><xsl:value-of select="pubDate"/></div>
			<div class="newsitemcontent">
				<xsl:value-of select="description" disable-output-escaping="yes"/>
				<!-- add link to comments if available -->
				<xsl:if test="comments">
					<xsl:variable name="commentlink" select="comments"/>
					<xsl:variable name="commentimg" select="'$IMAGEDIR$comments.gif'"/>
					<a href="{$commentlink}"><img src="{$commentimg}" border="0" hspace="6"/></a>
				</xsl:if>
				<!-- add link to enclosure if available -->
				<xsl:if test="enclosure">
					<xsl:variable name="enclosurelink" select="enclosure/@url"/>
					<xsl:variable name="enclosureimg" select="'$IMAGEDIR$enclosure.gif'"/>
					<a href="{$enclosurelink}"><img src="{$enclosureimg}" border="0" hspace="6"/></a>
				</xsl:if>
			</div>			
  		</xsl:for-each>
		
		<!-- channel image -->
		<xsl:if test="channel/image">
		  <xsl:variable name="imgurl" select="channel/image/url"/>
		  <xsl:variable name="imgtitle" select="channel/image/title"/>
		  <xsl:variable name="imglink" select="channel/image/link"/>
		  <a href="{$imglink}"><img class="channel" src="{$imgurl}" alt="{$imgtitle}"/></a>
		</xsl:if>
		
	</body>
	</html>
</xsl:template>

</xsl:stylesheet>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -