C# RSS生成(要引用的样式)

本文介绍了一个将RSS源转换为HTML格式的XSLT样式表文件。该样式表定义了RSS源中各项元素如标题、链接、描述等如何在HTML页面中布局及显示。样式表还包含了用于美化页面的基本CSS样式。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:dc="http://purl.org/dc/elements/1.1/" version="1.0">
<xsl:output method="xml"  />
<xsl:template match="/">

<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title><xsl:value-of select="rss/channel/title"/></title>
<style>

body {
 margin: 0px;
 padding: 0px;
 color: #000000;
 font-family: Arial, Helvetica;
 font-size: 9pt;
 background-color: #ffffff;
 color: #000000;
}

a:LINK {
 color: #666699;
 text-decoration: none;
}

a:ACTIVE {
 color: #ff0000;
}

a:VISITED {
 color: #000066;
 text-decoration: none;
}

a:HOVER {
 text-decoration: underline;
}

#Content {
 padding-top: 12px;
 padding-left: 35px;
 padding-right: 35px;
}

h1,h2,h4 {
 color: #666666;
 font-weight: bold;
 font-family: Arial, Arial, Helvetica;
 margin: 0px;
 font-size: 25pt;
}

h2 {
 font-size: 16pt;
 margin-left: 16px;
}

h4 {
 font-size: 11pt;
 font-family: Arial, Helvetica;
}


#ItemList {
 list-style-type: circle;
 color: #666666;
}

.ItemListItem {
 padding-bottom: 8px;
}

.ItemListItemDetails {
 font-family: Arial, Helvetica;
 font-size: 10pt;
 color: #333333;
}

</style>
</head>
<body xmlns="http://www.w3.org/1999/xhtml">

 <div id="Content">
      <h3><a><xsl:attribute name="href"><xsl:value-of select="rss/channel/link"/></xsl:attribute><xsl:value-of select="rss/channel/title" /></a></h3>
                  <div class="ItemListItemDetails">
                     描述:<xsl:value-of select="rss/channel/description"/>
                  </div>
                  <div class="ItemListItemDetails">
                        版权:<xsl:value-of select="rss/channel/copyright"/>
                     </div>
                     <div class="ItemListItemDetails">
                        日期: <xsl:value-of select="rss/channel/pubDate"/>
                     </div>
                   
           <ol id="ItemList">
   <xsl:for-each select="rss/channel/item">      
    <li class="ItemListItem">
    <h4><a><xsl:attribute name="href"><xsl:value-of select="link"/></xsl:attribute>
                                <xsl:value-of select="title" /></a></h4>
                                 <div class="ItemListItemDetails">
                                    内容: <xsl:value-of select="description" />
                                 </div>
                          
                                    类型: <xsl:value-of select="category"/>,
                   作者: <xsl:value-of select="author" />,
                  时间: <xsl:value-of select="pubdate" />
    </li>
   </xsl:for-each>
  </ol>

 </div>
 
</body>
</html>

</xsl:template>
</xsl:stylesheet>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值