有一下xml文件:
<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="rss.xslt" media="screen"?>
<rss version="2.0">
    <channel>
        <title>宁波市鄞州区统计网</title>
        <link>http://localhost:1757/</link>
        <description>Latest 20 threads</description>
        <copyright>Copyright (c) 宁波市鄞州区统计网</copyright>
        <generator>宁波市鄞州区统计网</generator>
        <pubDate>Tue, 27 Apr 2010 16:17:59 GMT</pubDate>
        <ttl>3600</ttl>
        <item>
            <title>塘溪镇将人普工作列入年度十大重点工作</title>
            <description>
                <![CDATA[
                    &lt;STYLE&gt;
                    &lt;!--
                     /* Font Definitions */
                     @font-face
                    {font-family:宋体;
                    panose-1:2 1 6 0 3 1 1 1 1 1;
                    mso-font-alt:SimSun;
                    mso-font-charset:134;
                    mso-generic-font-family:auto;
                    mso-font-pitch]]>
            </description>
            <link>http://localhost:1757/Page/ListPage.aspx?ListID=12712&amp;ModuleID=374 </link>
            <category>林祖伟</category>
            <author>林祖伟</author>
            <pubDate>Tue, 13 Apr 2010 16:36:00 GMT</pubDate>
        </item>
    </channel>
</rss>
我想通过rss.xslt文件将该xml数据转化为html
在rss.xslt文件中该怎么些呀?高人指点一下

解决方案 »

  1.   

    这个不难。
    通过3层遍历
    然后 StriBuilder连接就行了。
    或者使用Stream直接读取文件 过滤掉标签
      

  2.   

    给个样子吧<?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="html" encoding="utf-8" version="1.0" omit-xml-declaration="yes" indent="yes"/>
    <xsl:template match="/">
    <xsl:call-template name="rt"/>
    </xsl:template>
    <xsl:template name="rt">
    <html>
    <body>
    <table>
    <tr>
    <td>
    <xsl:value-of select="//channel/title"/>
    </td>
    <td>
    <xsl:value-of select="//channel/link"/>
    </td>
    </tr>
    </table>
    </body>
    </html>
    </xsl:template>
    </xsl:stylesheet>
      

  3.   

    LZ还是去学一下XSLT的基础语法吧,实际上不难的。 花两三个小时了解一下原理就可以搞定。