XSL 文件

<?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' indent='yes'/>  
    <xsl:template name="DOCTYPE">  
        <![CDATA[<!DOCTYPE html>]]> 
    </xsl:template> 
    <xsl:template match="/">
        <xsl:value-of select="document('')/*/xsl:template[@name='DOCTYPE']/node()" disable-output-escaping="yes"/>
        <html>
            <head>
                <!--<link type="text/css" rel="stylesheet" href="cd_catalog.css"/>-->
                <!--Import materialize.css-->
                <link type="text/css" rel="stylesheet" href="http://www.cmono.net/v2/materialize/css/materialize.min.css"  media="screen,projection"/>
                <title>RSS - CMONO.NET</title>
                <script type="text/javascript" src="http://www.cmono.net/v2/materialize/js/jquery-2.1.1.min.js"></script>
                <script type="text/javascript" src="http://www.cmono.net/v2/materialize/js/materialize.min.js"></script>
                <style>
                    ::-webkit-scrollbar
                    {
                        width: 10px;
                        height: 10px;
                    }

                    ::-webkit-scrollbar-track-piece
                    {
                        background-color: #fff !important;
                    }

                    ::-webkit-scrollbar-thumb
                    {
                        border-radius: 0;
                        background-color: #009688;
                    }

                    ::-webkit-scrollbar-thumb:hover
                    {
                        background-color: #4db6ac;
                    }

                    ::-webkit-scrollbar-thumb:active
                    {
                        background-color: #4db7ac;
                    }

                    ::-webkit-scrollbar-thumb:active
                    {
                        height: 50px;
                        -webkit-border-radius: 2px;
                        background-color: #4db8ac;
                    }

                </style>
            </head>
            <body>
                <div class="container">
                <div class="row">
                    <h2 class="center-align teal-text">CMONO.NET RSS</h2>
                </div> 
                <div class="row">
                <div class="col s12 m12 l12 center-on-small-only">
                <table class="bordered hoverable centered responsive-table">
                    <thead>
                        <tr>
                             <th >标题</th>
                             <th >作者/发布日期</th>
                        </tr>
                    </thead>
                    <tbody>
                    <xsl:for-each select="rss/channel/item">
                        <tr>
                            <td>
                                <a target="_blank">
                                    <xsl:attribute name="title">
                                        <xsl:value-of select="description" />
                                    </xsl:attribute>
                                    <xsl:attribute name="href">
                                        <xsl:value-of select="guid" />
                                    </xsl:attribute>
                                    <xsl:value-of select="title" />
                                </a>
                            </td>
                            <td><xsl:value-of select="author" /> / <xsl:value-of select="pubdate" /></td>
                        </tr>
                    </xsl:for-each>
                    </tbody>
                </table>
                </div> 
                </div> 
                </div>

                <footer class="page-footer teal">
                    <div class="container">
                      <div class="row">
                        <div class="col l6 m12 s12">
                          <h5 class="white-text">每日美颜</h5>
                          <p class="grey-text text-lighten-4">也许我不是最聪明的那个,但我一定要做最勤奋的那个。</p>
                        </div>
                        <div class="col l3 hide-on-small-only">
                          <h5 class="white-text">联系方式</h5>
                          <ul>
                            <li><a class="white-text" href="#!">QQ : 1134255297</a></li>
                            <li><a class="white-text" href="#!">新浪微博 : @MetroXCode</a></li>
                            <li><a class="white-text" href="#!">Skype : changweihua@outlook.com</a></li>
                          </ul>
                        </div>
                        <div class="col l3 hide-on-small-only">
                          <h5 class="white-text">CMONO.NET, Inc.</h5>
                          <ul>
                            <li><a class="white-text" href="#!">江苏省 无锡市 无锡新区, 214028</a></li>
                            <li><a class="white-text" href="#!"><abbr title="手机号码">P:</abbr> 185 **** ****</a></li>
                            <li><a class="white-text" href="#!">changweihua@outlook.com</a></li>
                          </ul>
                        </div>
                      </div>
                    </div>
                    <div class="footer-copyright">
                      <div class="container">
                        Made by <a class="teal-text text-lighten-3" href="http://www.cmono.net/v2/">Weihua Chang</a>
                        © 2009-2016 All Rights Reserved
                        <a class="grey-text text-lighten-4 right" href="http://www.cmono.net/v2/">返回主页</a>
                      </div>
                    </div>
                </footer>

            </body>
        </html>
    </xsl:template>

</xsl:stylesheet>

效果图

知识共享许可协议
《XML 通过 XSL 文件格式转换》 常伟华 创作。
本作品采用知识共享署名-相同方式共享 4.0 国际许可协议 | 3.0 中国大陆许可协议进行许可。

站内公告