日期:2014-4-6 浏览次数:20252次

如何实现XML+XSL+javascript数据排序

数据排序模版
<?xml version="1.0" encoding="gb2312" ?>
<xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
    <xsl:output method="html" />
    <xsl:param name="queryParam" select="'" />
    <xsl:template match="/guestbook">
        <table border="0">
            <tbody>
                <tr>
                    <td>
                        <table width="400" border="0">
                            <tbody>                             
                                <xsl:apply-templates select="article">
                                    <xsl:sort select="datadate" order="descending" />
                                </xsl:apply-templates>                                  
                            </tbody>
                        </table>
                    </td>
                </tr>
            </tbody>
        </table>
    </xsl:template>
    <!--文章列表模版:-->
    <xsl:template match="article">
        <xsl:choose>
            <xsl:when test="position() mod 2 = 1">
                <tr bgcolor="#cccccc">
                    <th align="left" width="50">作者</th>
                    <th align="left" width="50">
                        <xsl:val