在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
先编写一个自己的xsl:dsclub.xsl
<?xml version="1.0" encoding="UTF-8" ?>
<!-- Coding:DSclub --> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html" /> <xsl:template match="rss/channel"> <html> <head> <title><xsl:value-of select="title" /></title> <style type="text/css"><![CDATA[ body{text-align:center;} .ChannelTitle { font:bolder 16px "Impact",serif; } .ArticleContent { } .ArticleTitle { background-color: #336699; color: #FFF; font: bold 12px "Verdana",sans-serif; padding: 5px; border-top:1px solid #99CCFF; border-left:1px solid #99CCFF; border-bottom:1px solid #336699; border-right:1px solid #000; } .ArticleTitle a { color:#FFF; } .pubTime { margin-top:3px; display:block; font:normal 9px serif; } .ArticleDescription { color: #000; font:normal 12px serif; padding:10px; text-align:left; border:1px solid #000; }]]> </style> </head> <body> <xsl:apply-templates select="title" /> <xsl:apply-templates select="item" /> </body> </html> </xsl:template> <xsl:template match="title"> <div class="ChannelTitle"> <xsl:value-of select="text()" /> </div> <br /> </xsl:template> <xsl:template match="item"> <div class="ArticleContent"> <div class="ArticleTitle"> <a href="{link}"><xsl:value-of select="title" /></a> <span class="pubTime"> <xsl:value-of select="pubDate" /> </span> </div> <div class="ArticleDescription"> <xsl:value-of select="description" disable-output-escaping="yes"/> </div> </div> <br /> </xsl:template> </xsl:stylesheet> 在aspx中
public void TransXML(string strXMLURL)
} 再调用这个方法:
TransXML("http://www.cnblogs.com/dsclub/Rss.aspx");
运行这个aspx就OK了。 |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论