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

📄 default.xsl

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

<xsl:stylesheet version="1.0"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html"/>

<xsl:variable name="common-styles">
	<style type="text/css">
		body { background-color: white; color: black; font: 84% Verdana, Arial, sans-serif; margin: 12px 22px; }
		a { color: #0002CA; }
		a:hover { color: #6B8ADE; text-decoration: underline; }
		span.nodescription {	color: silver;	font-size: smaller; }

		/* override headings used by feeds */
		h1,h2,h3,h4,h5,h6 { font-size: 80%; font-weight: bold; font-style: italic;	}

		div.favchannel { 
			overflow: hidden; 
			/*filter: progid:DXImageTransform.Microsoft.Gradient(gradientType=0,startColorStr=#D6DFF7,endColorStr=#EEF5FC);*/
			border: 1px solid #6B8ADE;
			background-color: #D6DFF7; 
			float: left; 
			margin: 0 14px 10px 0; 
			padding: 16px 16px 0 16px; width: 40%;
		}

		div.newspapertitle { font-weight: bold; font-size: 120%; text-align: center; padding-bottom: 12px; text-transform: uppercase; }
		div.channel { border-bottom: 1px dotted silver; margin-top: 14px}
		div.channeltitle { font-weight: bold; text-transform: uppercase; margin-top: 12px; margin-bottom: 18px;}
		img.channel { border: none; }

		div.newsitemcontent { line-height: 140%; }
		div.newsitemcontent ol, div.newsitemcontent ul { list-style-position: inside;}		
		div.newsitemtitle { font-weight: bold; margin-bottom: 8px }
		div.newsitemfooter { color: gray; font-size: xx-small; text-align: left; margin-top: 6px; margin-bottom: 18px; }

		div.newsitemtitle a, div.newsitemcontent a, div.newsitemfooter a { text-decoration: none; }
	</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"/>
		<style>
			div.newspapertitle { margin-bottom: 12px; border-bottom: 1px dashed silver;  }
		</style>
	</head>
	<body>
		<div class="newspapertitle">
			<!-- channel title -->		
			<xsl:value-of select="title"/>
			<!-- 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"/>
			  <br/>
			  <a href="{$imglink}"><img class="channel" src="{$imgurl}" alt="{$imgtitle}" align="bottom" style="margin-top: 8px;"/></a>
			</xsl:if>
		</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="newsitemcontent">
				<xsl:value-of select="description" disable-output-escaping="yes"/>
			</div>
			<div class="newsitemfooter">
				<xsl:value-of select="pubDate"/>
			</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.newsitemtitle { border-bottom: 1px dotted silver; margin-bottom: 10px; padding-bottom: 10px;}
			div.newsitemfooter { text-align: right; margin-top: 14px; padding-top: 6px; border-top: 1px dashed #CBCBCB; }
		</style>
	</head>
	<body>
		<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="newsitemcontent">
				<xsl:value-of select="description" disable-output-escaping="yes"/>
			</div>
			<div class="newsitemfooter">
				<xsl:variable name="srclink" select="source/@htmlUrl"/>
				<a href="{$srclink}"><xsl:value-of select="source"/></a>
				<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>
				<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>
				<br />
				<xsl:value-of select="pubDate"/>
			</div>
  		</xsl:for-each>
		
	</body>
	</html>
</xsl:template>

</xsl:stylesheet>

⌨️ 快捷键说明

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