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

📄 register.xsl

📁 JPluck是一个基于Java的工具集
💻 XSL
字号:
<?xml version="1.0" encoding="UTF-8"?>
<?jpluck name="The Register"
    description="Extract the article headings and contents"
    uri-pattern="http://www.theregister.com/.*"
?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml" version="1.0">
	<xsl:param name="uri"/>
	<xsl:template match="/">
		<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
			<head>
				<xsl:copy-of select="/html/head/title"/>
			</head>
			<body link="#0000DD"  bgcolor="white">
				<!-- if we are at the top level, get the article titles -->
				<xsl:if test="starts-with($uri,'http://www.theregister.com/index')">
           <p>
    					<img src="http://www.theregister.com/Themes/Normal/Masthead.gif" alt="The Register"/>
           </p>
             <xsl:variable name="updated"><xsl:value-of select="//td[@class='indexdate']"/></xsl:variable>
             <xsl:value-of select="normalize-space(substring-before($updated,'Updated:'))"/>
             <br />Updated:
             <xsl:value-of select="normalize-space(substring-after($updated,'Updated:'))"/>
  					<xsl:copy-of select="//table[position()=2]//tr[position()=1]/td[position()=2]/table[position()=1]//tr[position()=2]/td/*"/>
				</xsl:if>
				<!-- if we are at the second level, get the article content -->
				<xsl:if test="starts-with($uri,'http://www.theregister.com/content')">
					<xsl:apply-templates select="//table[position()=2]//tr[position()=1]/td[position()=2]/table[position()=1]//tr[position()=2]/td[position()=1]/div[position()=1]/*"/>
				</xsl:if>
			</body>
		</html>
	</xsl:template>

  <xsl:template match="div[@class = 'storyhead']">
    <xsl:element name="b">
      <xsl:value-of select="."/>
    </xsl:element>
    <br />
  </xsl:template>

  <xsl:template match="div[(@class = 'storybyline') or (@class = 'indexposted')]">
    <xsl:value-of select="."/>
    <br />
  </xsl:template>
  
  <xsl:template match="node() | @*">
    <xsl:copy>
      <xsl:apply-templates select="@*"/>
      <xsl:apply-templates/>
    </xsl:copy>
  </xsl:template>
</xsl:stylesheet>

⌨️ 快捷键说明

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