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

📄 rss.xsl

📁 JPluck是一个基于Java的工具集
💻 XSL
字号:
<?xml version="1.0" encoding="UTF-8"?>
<?jpluck name="RSS" description="Formats RSS feeds" doctype="rss|rdf:RDF"?>
<!-- A really quick-and-dirty stylesheet. This needs more work. -->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:rss="http://purl.org/rss/1.0/">
	<xsl:param name="showImage" select="true()"/>
	<xsl:param name="showDescription" select="true()"/>
	<xsl:template match="text()|@*|*">
		<!--This template copies text attributes and elements-->
		<xsl:copy>
			<xsl:apply-templates select="*|@*|text()"/>
		</xsl:copy>
	</xsl:template>
	<xsl:template match="/">
		<html>
			<body>
				<xsl:apply-templates select="//*[local-name()='channel']"/>
				<ul>
					<xsl:apply-templates select="//*[local-name()='item']"/>
				</ul>
			</body>
		</html>
	</xsl:template>
	<xsl:template match="*[local-name()='channel']">
		<div align="center">
			<xsl:choose>
				<xsl:when test="image and $showImage">
					<p>
						<xsl:apply-templates select="//*[local-name()='image']"/>
					</p>
				</xsl:when>
				<xsl:otherwise>
					<h1>
						<xsl:value-of select="*[local-name()='title']"/>
					</h1>
				</xsl:otherwise>
			</xsl:choose>
			<xsl:if test="$showDescription">
				<p>
					<xsl:value-of select="*[local-name()='description']"/>
				</p>
			</xsl:if>
		</div>
	</xsl:template>
	<xsl:template match="*[local-name()='item']">
		<li>
			<a href="{*[local-name()='link']}">
				<xsl:choose>
					<xsl:when test="*[local-name()='title']">
						<xsl:value-of select="*[local-name()='title']"/>
					</xsl:when>
					<xsl:otherwise>
						<xsl:value-of select="*[local-name()='link']"/>
					</xsl:otherwise>
				</xsl:choose>
			</a>
			<br/>
			<xsl:apply-templates select="*[local-name()='description']"/>
		</li>
	</xsl:template>
	<xsl:template match="*[local-name()='image']">
		<img src="{*[local-name()='url']}" alt="{*[local-name()='title']}"/>
	</xsl:template>
</xsl:stylesheet>

⌨️ 快捷键说明

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