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

📄 headlines.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 { background-color: white; color: black; font: 80% Tahoma, Verdana, Arial, sans-serif; margin: 2px 28px; }
		a { color: #0002CA; text-decoration: none }
		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.newspapertitle { font-weight: bold; font-size: 120%; text-align: center; text-transform: uppercase; margin: 24px 0}
		
		div.channeltitle { font-weight: bold; text-transform: uppercase; margin-top: 12px; }
		div.channeltitle a { text-decoration: underline; }

		div.newsitemcontent ol, div.newsitemcontent ul { list-style-position: inside;}		
		div.newsitemtitle { margin-bottom: 3px }
		div.newsitemfooter { color: gray; font-size: xx-small; text-align: right; font-style: italic; margin-top: 6px; margin-bottom: 18px; }
		div.newsitemcontent { line-height: 150%; }
	</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"><xsl:value-of select="title" disable-output-escaping="yes"/></div>
		
		<!-- loop through each news item -->
		<ol>
		<xsl:for-each select="item">
			<xsl:sort select="fd:sortKey" data-type="number" order="descending"/>
		   <div class="newsitemtitle">
			  <xsl:variable name="itemlink" select="link"/>
		       <li><a href="{$itemlink}"><xsl:value-of select="title" disable-output-escaping="yes"/></a></li>
			</div>
  		</xsl:for-each>
		</ol>
	</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 { text-transform: none; text-align: left; margin: 14px 0; font-size: 100%}
			div.newspapertitle a { text-decoration: underline;	}
		</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="newsitemcontent">
				<xsl:value-of select="description" disable-output-escaping="yes"/>
			</div>
			<div class="newsitemfooter">
				<!-- 
				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.
				-->
				<xsl:variable name="srclink" select="source/@htmlUrl"/>
				<a href="{$srclink}"><xsl:value-of select="source"/></a>
				<!-- 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>
				<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 + -