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

📄 tree.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> 
	   .SpanDetails { CURSOR: hand ;color:#e6433c}
	   .Title {FONT-WEIGHT: normal; FONT-SIZE: 8pt; FONT-FAMILY: Tahoma, Verdana, Arial }
	</STYLE>
</xsl:variable>
<xsl:variable name="common-script">
	<script language="javascript"><![CDATA[
		function clickHandler(v)
		{
			var theElement = v.parentElement;
			var objChild=theElement.getElementsByTagName("DIV")[0];
			if (objChild.style.display == "none")
				objChild.style.display = "";
			else
				objChild.style.display = "none";                
		}
	]]></script>
</xsl:variable>

<!-- channel newspaper -->
<xsl:template match="channel">
	<html xmlns:m="http://www.w3.org/1998/Math/MathML">
	<head>
		<title>Channel</title>
		<xsl:copy-of select="$common-styles"/>
		<xsl:copy-of select="$common-script"/>
	</head>
	<body bgColor="#eeeeee" marginheight="1" marginwidth="1" language="javascript">
	  <table class="Title" border="0" width="100%" bgcolor="#FFFFFF" cellspacing="0" cellpadding="5">
	    <TR>
	      <TD>
		<table border="0" width="100%" cellspacing="0" cellpadding="1">
		  <TR>
		    <TD height="40" bgcolor="#EEEEEE">
		      <!-- channel title -->
		      <xsl:variable name="channelurl" select="link"/>
			<b><a href="{$channelurl}"><font face="Verdana" size="4"><xsl:value-of select="title"/></font></a></b>
			<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"/>
			  <xsl:choose>
					<xsl:when test="url=''"></xsl:when>
					<xsl:otherwise>
					  <br/>
			          <a href="{$imglink}"><img src="{$imgurl}" alt="{$imgtitle}" border="0"/>
			          </a>
					</xsl:otherwise>
			  </xsl:choose>
			</xsl:if>
		    </TD>
		  </TR>
		  <TR>
		    <TD colspan="3" height="10" bgcolor="#C0C0C0"></TD>
		  </TR>
		</table>
	      </TD>
	    </TR>
	    <tr>
	      <td>
		<DIV>
		  <!-- loop through each news item -->
		  <xsl:for-each select="item">
		    <DIV>
		      <xsl:choose>
			<xsl:when test="readed='false'">
			  <IMG src="$ImagesFolder$unread.gif" align="absmiddle" vspace="3"/>
			</xsl:when>
			<xsl:otherwise>
			  <IMG src="$ImagesFolder$read.gif" align="absmiddle" vspace="3"/>
			</xsl:otherwise>
		      </xsl:choose>
			<IMG src="$ImagesFolder$snippet.gif" align="absmiddle" vspace="3"/>
			<xsl:variable name="itemlink" select="link"/>
			<A HREF="{$itemlink}"><xsl:value-of select="title" disable-output-escaping="yes"/></A> - 
			<SPAN onClick="clickHandler(this)" class="SpanDetails">[璇︾粏淇℃伅]</SPAN><br/>
			<DIV style="display:none; padding:4;MARGIN-LEFT:10px;background-color:whitesmoke;border-color:gray;border-width:1;border-style:solid">
			  <B>PubDate</B>     :<xsl:value-of select="pubDate"/><br/>
			  <B>Description</B> :
			  <DIV style="padding:4;MARGIN-LEFT:0px;background-color:white;border-color:gray;border-width:1;border-style:solid"><xsl:value-of select="description" disable-output-escaping="yes"/><br/>
			  </DIV>
			</DIV>
		    </DIV>
		  </xsl:for-each>
		</DIV>
	      </td>
	    </tr>
	  </table>
	</body>
      </html>
</xsl:template>

<!-- single news item -->
<xsl:template match="items">
	<html xmlns:m="http://www.w3.org/1998/Math/MathML">
	<head>
		<title>Items</title>
		<xsl:copy-of select="$common-styles"/>
		<xsl:copy-of select="$common-script"/>
	</head>
	<body bgColor="#eeeeee" marginheight="1" marginwidth="1" language="javascript">
	  <table class="Title" border="0" width="100%" bgcolor="#FFFFFF" cellspacing="0" cellpadding="5">
	    <TR>
	      <TD>
		<table border="0" width="100%" cellspacing="0" cellpadding="1">
		  <TR>
		    <TD height="40" bgcolor="#EEEEEE">
		      <!-- channel title -->		
			<b><font face="Verdana" size="4">Selected Items</font></b>
			<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>
		    </TD>
		  </TR>
		  <TR>
		    <TD colspan="3" height="10" bgcolor="#C0C0C0"></TD>
		  </TR>
		</table>
	      </TD>
	    </TR>
	    <tr>
	      <td>
		<DIV>
		  <!-- loop through each news item -->
		  <xsl:for-each select="item">
		    <DIV>
		      <xsl:choose>
			<xsl:when test="readed='false'">
			  <IMG src="$ImagesFolder$unread.gif" align="absmiddle" vspace="3"/>
			</xsl:when>
			<xsl:otherwise>
			  <IMG src="$ImagesFolder$read.gif" align="absmiddle" vspace="3"/>
			</xsl:otherwise>
		      </xsl:choose>
			<IMG src="$ImagesFolder$snippet.gif" align="absmiddle" vspace="3"/>
			<xsl:variable name="itemlink" select="link"/>
			<A HREF="{$itemlink}"><xsl:value-of select="title" disable-output-escaping="yes"/></A> - 
			<SPAN onClick="clickHandler(this)" class="SpanDetails">[璇︾粏淇℃伅]</SPAN><br/>
			<DIV style="display:none; padding:4;MARGIN-LEFT:10px;background-color:whitesmoke;border-color:gray;border-width:1;border-style:solid">
			  <B>PubDate</B>     :<xsl:value-of select="pubDate"/><br/>
			  <B>Description</B> :
			  <DIV style="padding:4;MARGIN-LEFT:0px;background-color:white;border-color:gray;border-width:1;border-style:solid"><xsl:value-of select="description" disable-output-escaping="yes"/><br/>
			  </DIV>
			</DIV>
		    </DIV>
		  </xsl:for-each>
		</DIV>
	      </td>
	    </tr>
	  </table>
	</body>
      </html>
</xsl:template>

</xsl:stylesheet>

⌨️ 快捷键说明

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