slashdot.xslt

来自「beereader source code」· XSLT 代码 · 共 56 行

XSLT
56
字号
<xsl:stylesheet version='1.0' 
		xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
		xmlns:content = 'http://purl.org/rss/1.0/modules/content/'
		xmlns:xhtml='http://www.w3.org/1999/xhtml'
		xmlns:slash='http://purl.org/rss/1.0/modules/slash/' 
	  xmlns:dc='http://purl.org/dc/elements/1.1/' >

		<xsl:output method='xml' indent='yes' /> 

		<xsl:template match='/'>
		<html><head><title><xsl:value-of select='//item/title'/></title></head>
	<body>
		<table width="100%" border="0" cellpadding="0" cellspacing="0"><tr>
	<td valign="top" bgcolor="#006666">	
	<font
	face="arial,helvetica" size="4" color="#FFFFFF">
	<b><xsl:value-of  disable-output-escaping='yes' select='//item/title'/></b></font></td>
</tr></table>
<xsl:choose>
				<xsl:when test='//item/author'>
					<b>Posted by <xsl:value-of select='//item/author'/></b>
				</xsl:when>
				<xsl:when test='//item/dc:creator'>
					<b>Posted by <xsl:value-of select='//item/dc:creator'/></b>
				</xsl:when>				
            </xsl:choose>
	<b><xsl:text>&#160;</xsl:text> on <xsl:value-of select='//item/pubDate'/></b><br />
	<xsl:if test='//item/category'><b><font size="2">from the 
   <xsl:value-of select='//item/category' /> dept.<b></b></font></b></xsl:if>
   <br />
 <xsl:choose>
				<xsl:when test='//item/xhtml:body'>
					<xsl:copy-of select='//item/xhtml:body'/>
				</xsl:when>
				<xsl:when test='//item/content:encoded'>
					<xsl:value-of  disable-output-escaping='yes' select='//item/content:encoded'/>
				</xsl:when>
				<xsl:otherwise>
					<xsl:value-of disable-output-escaping='yes' select='//item/description'/>
				</xsl:otherwise>
            </xsl:choose>
<p>
<b>(</b>
<a href='{//item/link}'><b>Read on...</b></a> 
<xsl:if test='//item/comments'> | 
 <xsl:text disable-output-escaping='yes'>&amp;nbsp;</xsl:text>
 <xsl:text disable-output-escaping='yes'>&lt;a href='</xsl:text><xsl:value-of  disable-output-escaping='yes' select='//item/comments'/><xsl:text disable-output-escaping='yes'>'&gt;</xsl:text>
 <b><xsl:value-of select='//item/slash:comments'/> Comments...</b>
 <xsl:text disable-output-escaping='yes'>&lt;/a></xsl:text>				
 </xsl:if>	
<b>)</b>
</p>
		
</body></html>
</xsl:template>
</xsl:stylesheet>

⌨️ 快捷键说明

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