123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- <?xml version="1.0" encoding="UTF-8"?>
- <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
- <xsl:param name="size" select="50"/>
- <xsl:template match="/">
- <html>
- <script>
- <![CDATA[
- function nextPage(num){
- document.getElementById("content"+num).style.display="";
- num--;
- document.getElementById("content"+num).style.display="none";
- }
- function prevPage(num){
- document.getElementById("content"+num).style.display="";
- num++;
- document.getElementById("content"+num).style.display="none";
- }
- function firstPage(num){
- document.getElementById("content"+1).style.display="";
- document.getElementById("content"+num).style.display="none";
- }
- function lastPage(num,last){
- document.getElementById("content"+last).style.display="";
- document.getElementById("content"+num).style.display="none";
- }
-
- function onInitialize(){
- for(var i = 0; i< 1000; i++)
- {
- var a = document.getElementById("content"+i)
- if(a)
- {
- document.getElementById("content"+i).style.display = "none";
- }
- var b = document.getElementById("content"+1)
- if(b)
- {
- document.getElementById("content"+1).style.display = "";
- }
- }
- }
- ]]>
- </script>
- <body onload="onInitialize()">
- <xsl:apply-templates select="data/subdata[position() mod $size = 1]">
- <xsl:with-param name="pages" select="ceiling(count(data/subdata) div $size)"/>
- </xsl:apply-templates>
- </body>
- </html>
- </xsl:template>
- <xsl:template match="data/subdata">
- <xsl:param name="pages"/>
- <xsl:variable name="page" select="position()"/>
- <div id='content{$page}' style="display:'none'">
- <table width="740" border="0" align="center" cellpadding="1" cellspacing="1" bordercolordark="#ffffff" bordercolorlight="#ADAAAD" style="font-family:Arial, Helvetica, sans-serif; font-size:12px;">
- <tr>
- <td colspan="3">
- <xsl:value-of select="$page" />/<xsl:value-of select="$pages" /> 页
- <xsl:choose>
- <xsl:when test="$page = 1">
- <span style="color:#999">第一页</span> -
- <span style="color:#999">上一页</span> -
- <a href="#{$page + 1}" onclick="nextPage({$page + 1})">下一页</a> -
- <a href="#{$pages}" onclick="lastPage({$page},{$pages})">最后一页</a>
- </xsl:when>
- <xsl:when test="$page = $pages">
- <a href="#{1}" onclick="firstPage({$page})">第一页</a> -
- <a href="#{$page - 1}" onclick="prevPage({$page - 1})">上一页</a> -
- <span style="color:#999">下一页</span>
- <span style="color:#999">最后一页</span>
- </xsl:when>
- <xsl:otherwise>
- <a href="#{1}" onclick="firstPage({$page})">第一页</a> -
- <a href="#{$page - 1}" onclick="prevPage({$page - 1})">上一页</a> -
- <a href="#{$page + 1}" onclick="nextPage({$page + 1})">下一页</a> -
- <a href="#{$pages}" onclick="lastPage({$page},{$pages})">最后一页</a>
- </xsl:otherwise>
- </xsl:choose>
- </td>
- </tr>
- <tr bgcolor="#FFCC99" align="center">
- <td height="5" colspan="3"></td>
- </tr>
- <tr bgcolor="#FFCC99" align="center">
- <td height="20"><strong>变量名称</strong></td>
- <td><strong>值</strong></td>
- <td><strong>发生时间</strong></td>
- </tr>
- <xsl:for-each select="self::subdata | following-sibling::subdata[position()<$size]">
- <tr align="center">
- <td bgcolor="#eeeeee" height="16"><xsl:value-of select="varname"/></td>
- <td bgcolor="#f3f3f3"><xsl:value-of select="value"/></td>
- <td bgcolor="#efefef"><xsl:value-of select="happentime"/></td>
- </tr>
- </xsl:for-each>
- </table>
- </div>
- </xsl:template>
- </xsl:stylesheet>
|