• <label id="pxtpz"><meter id="pxtpz"></meter></label>
      1. <span id="pxtpz"><optgroup id="pxtpz"></optgroup></span>

        當(dāng)前位置:雨林木風(fēng)下載站 > 技術(shù)開(kāi)發(fā)教程 > 詳細(xì)頁(yè)面

        僅用xsl與asp完成分頁(yè)技巧

        僅用xsl與asp完成分頁(yè)技巧

        更新時(shí)間:2022-05-13 文章作者:未知 信息來(lái)源:網(wǎng)絡(luò) 閱讀次數(shù):

        注意事項(xiàng):
        ※本文代碼可能有一些多余部分未去掉,請(qǐng)?jiān)陂喿x時(shí)忽略。
          一些外部include進(jìn)來(lái)的文件這里就不貼上來(lái)了。
        ※小乙寫(xiě)xsl也不久,很多語(yǔ)句都不會(huì)使用,有些地方寫(xiě)得比較羅嗦,
          如果您有更好的分頁(yè)代碼,請(qǐng)多多拿來(lái)交流。
        ※適用于:用asp load進(jìn)來(lái)xml代碼,然后用此xsl文件進(jìn)行分頁(yè)處理。
        ※[2001.2.19]
        ------------------------------------
        asp文件大致結(jié)構(gòu):
        <%@ Language=VBScript %>
        <!-- #include file=include/lib.asp -->
        <%
        cc=server.MapPath("trans.xml")
        set source=server.CreateObject("msxml2.domdocument")
        source.async=false
        source.load(cc)

        xslfile=server.MapPath("index.xsl")
        set style=server.CreateObject("msxml2.domdocument")
        style.async=false
        style.load(xslfile)

        'Response.write source.transformNode(style)
        Response.write gb_html(source.transformNode(style))
        Response.End
        %>
        ------------------------------------load進(jìn)來(lái)的xml數(shù)據(jù)是這樣的:
        <?xml version="1.0" encoding="GB2312" ?>
        <root>
        <function>
        <PO>里面的標(biāo)簽在后面的xsl文件里被"<xsl:for-each>"</PO>
        <PO>……………………</PO>
        <PO>……………………</PO>
        <PO>……………………</PO>
        </function>
        </root>


        ------------------------------------
        xsl文件的內(nèi)容:

        <?xml version="1.0" encoding="GB2312"?>
        <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
        <xsl:include href="include/ydzhongxin.xsl"/><!--  嵌入頭模板,尾模板  -->
        <xsl:param name="yd">7</xsl:param><!--  調(diào)用二級(jí)導(dǎo)航條所用參數(shù) -->
        <xsl:param name="page">    <xsl:value-of select="count(//PO)"/></xsl:param>

        <!-- 定義根模板  -->
        <xsl:template match="/">
        <html>
        <head>
        <meta http-equiv="Content-Type" content="text/html; charset=gb2312"/>
        <link rel="stylesheet" type="text/css" href="include/style.css"/>
        <title>結(jié)果列表</title>
        </head>
        <body leftMargin="0" topMargin="0">
        <xsl:call-template name="ydtitle"/>

                <div align="center">
                <xsl:apply-templates select="root/function"/>
                <!--  匹配function模板  -->
                </div>

        <xsl:call-template name="end"/>
        </body>
        </html>
        </xsl:template>



        <!--  定義function模板  -->
        <xsl:template match="function">
        <!-- ---------------翻頁(yè)鏈接開(kāi)始----------- -->
        <xsl:variable name="pagesize">5</xsl:variable><!--  是分頁(yè)參數(shù) -->

        <xsl:choose>
        <xsl:when test="/root/session/page[text()!='']">
        <!-- 進(jìn)入一級(jí)choose的一個(gè)when條件分支。。。!
        -------------進(jìn)入此分支,證明用戶已有翻頁(yè)操作-------------- -->
        <xsl:variable name="page"><xsl:value-of select="/root/session/page"/></xsl:variable>
        <table border="0" cellpadding="2" cellspacing="0" width="630">
            <tr>
                <td align="right">
                <!-- 進(jìn)入二級(jí)choose。。 -->
                <xsl:choose>
                <!-- ①id小于等于0的情況,顯示最后一頁(yè)。-->
                <xsl:when test="$pid&lt;1">
                <a><xsl:attribute name="href">search_jieguo.asp?id=<xsl:value-of select="count
        (//PO)"/></xsl:attribute>
        &#91; 首 &#93;</a>
                <a title="前一頁(yè)"><xsl:attribute name="href">search_jieguo.asp?id=<xsl:value-of
        select="$size*2"/></xsl:attribute>&#91; &#60;&#60;&#60; &#93; </a>
                <a title="后一頁(yè)">&#91; &#62;&#62;&#62; &#93; </a>
                <a>&#91; 尾 &#93;</a>
                </xsl:when>
                <!-- ②id位于[0~pagesize]之間的情況,前頁(yè)正常,后頁(yè)無(wú)。 -->
                <xsl:when test="$pid&lt;($size + 1) and $pid&gt;0">
                <a><xsl:attribute name="href">search_jieguo.asp?id=<xsl:value-of select="count
        (//PO)"/></xsl:attribute>
        &#91; 首 &#93;</a>
                <a title="前一頁(yè)"><xsl:attribute name="href">search_jieguo.asp?id=<xsl:value-of
        select="$pid+$size"/></xsl:attribute>&#91; &#60;&#60;&#60; &#93; </a>
                <a title="后一頁(yè)">&#91; &#62;&#62;&#62; &#93; </a>
                <a>&#91; 尾 &#93;</a>
                </xsl:when>
                <!-- ③id位于[pagesize~count]之間的情況,前頁(yè)無(wú),后頁(yè)正常。 -->
                <xsl:when test="$pid&lt;count(//PO) and $pid&gt;(count(//PO)-$size)">
                <a><xsl:attribute name="href">search_jieguo.asp?id=<xsl:value-of select="count
        (//PO)"/></xsl:attribute>
        &#91; 首 &#93;</a>
                <a title="前一頁(yè)"><xsl:attribute name="href">search_jieguo.asp?id=<xsl:value-of select="count
        (//PO)"/></xsl:attribute>&#91; &#60;&#60;&#60; &#93; </a>
                <a title="后一頁(yè)"><xsl:attribute name="href">search_jieguo.asp?id=<xsl:value-of select="$pid -
        $size"/></xsl:attribute>&#91; &#62;&#62;&#62; &#93; </a>
                <a><xsl:attribute name="href">search_jieguo.asp?id=<xsl:value-of select="$size"/></xsl:attribute>
        &#91; 尾 &#93;</a>
                </xsl:when>

                <!-- ④id等于count的情況,顯示首頁(yè)。 -->
                <xsl:when test="$pid=count(//PO)">
                <a>&#91; 首 &#93;</a>
                <a title="前一頁(yè)">&#91; &#60;&#60;&#60; &#93; </a>
                <a title="后一頁(yè)"><xsl:attribute name="href">search_jieguo.asp?id=<xsl:value-of select="count
        (//PO)-$size"/></xsl:attribute>&#91; &#62;&#62;&#62; &#93; </a>
                <a><xsl:attribute name="href">search_jieguo.asp?id=<xsl:value-of select="$size"/></xsl:attribute>
        &#91; 尾 &#93;</a>
                </xsl:when>
                <!-- ⑤id大于count的情況,顯示首頁(yè)。 -->
                <xsl:when test="$pid&gt;count(//PO)">
                <a>&#91; 首 &#93;</a>
                <a title="前一頁(yè)">&#91; &#60;&#60;&#60; &#93; </a>
                <a title="后一頁(yè)"><xsl:attribute name="href">search_jieguo.asp?id=<xsl:value-of select="count
        (//PO)-$size"/></xsl:attribute>&#91; &#62;&#62;&#62; &#93; </a>
                <a><xsl:attribute name="href">search_jieguo.asp?id=<xsl:value-of select="$size"/></xsl:attribute>
        &#91; 尾 &#93;</a>
                </xsl:when>

                <!-- 正常情況 -->
                <xsl:otherwise>
                <a><xsl:attribute name="href">search_jieguo.asp?id=<xsl:value-of select="count
        (//PO)"/></xsl:attribute>
        &#91; 首 &#93;</a>
                <a title="前一頁(yè)"><xsl:attribute name="href">search_jieguo.asp?id=<xsl:value-of select="$pid +
        $size"/></xsl:attribute>&#91; &#60;&#60;&#60; &#93; </a>
                <a title="后一頁(yè)"><xsl:attribute name="href">search_jieguo.asp?id=<xsl:value-of select="$pid -
        $size"/></xsl:attribute>&#91; &#62;&#62;&#62; &#93; </a>
                <a><xsl:attribute name="href">search_jieguo.asp?id=<xsl:value-of select="$size"/></xsl:attribute>
        &#91; 尾 &#93;</a>
                </xsl:otherwise>
                </xsl:choose>
                <!-- ---------------------------------------- -->
                            </td>
                            </tr>
                        </table><br/>
                    <!-- ---------遍歷符合要求的PO結(jié)點(diǎn)------------- -->
                    <xsl:for-each select="PO[position()&lt;=$pid and position()&gt;($pid - $size)]">
                        <xsl:sort select="PO_ID" order="descending" data-type="number"/>
                        <xsl:call-template name="PO"/>
                        <br/><br/><br/>
                    </xsl:for-each>
        <!-- 退出一級(jí)choose的一個(gè)when條件分支。。。! -->
        </xsl:when>
        <!-- ------------------用戶直接進(jìn)入的狀態(tài)------------------ -->
        <xsl:otherwise>
        <!-- 進(jìn)入一級(jí)choose的另一個(gè)when條件分支!。。! -->
        <table border="0" cellpadding="2" cellspacing="0" width="630">
        <tr><td align="right">
        <a>&#91; 首 &#93;</a>
        <a title="前一頁(yè)">&#91; &#60;&#60;&#60; &#93; </a>
        <a title="后一頁(yè)"><xsl:attribute name="href">search_jieguo.asp?id=<xsl:value-of select="$pid -
        $size"/></xsl:attribute>&#91; &#62;&#62;&#62; &#93; </a>
        <a><xsl:attribute name="href">search_jieguo.asp?id=<xsl:value-of select="$size"/></xsl:attribute>
        &#91; 尾 &#93;</a>
        </td></tr>
        </table><br/>
                    <xsl:for-each select="PO[position()&lt;=$pid and position()&gt;($pid - $size)]">
                        <xsl:sort select="PO_ID" order="descending" data-type="number"/>
                        <xsl:call-template name="PO"/>
                        <br/><br/><br/>
                    </xsl:for-each>
        <!-- 退出一級(jí)choose的另一個(gè)when條件分支。。。! -->
        </xsl:otherwise>
        </xsl:choose>
                <!-- --------------翻頁(yè)鏈接到此結(jié)束----------- -->
                <br/>
                <xsl:if test="count(//PO)=0">

            <div align="center"><b>
              <img src=http://www.okasp.com/techinfo/"images/msg2.gif" align="absmiddle"/>&#127;
              </b><font color="#CC0000" face="楷體CS" size="3"><b>
              沒(méi)有符合當(dāng)前條件的訂單</b></font>
              <a><xsl:attribute name="href">lkxx.asp?po_id=<xsl:value-of select="PO_ID"/></xsl:attribute></a>
            </div>
        ><br/><br/>
        <input type="button" value="重新輸入條件查詢" onclick="location.href='search.asp'"/>
                </xsl:if>
            </xsl:template>






        <!-- ------------------------------------------>
        <xsl:template name="PO">
          <table border="1" cellpadding="2" cellspacing="0" width="100%">
            <tr>
              <td nowrap="nowrap" width="70"> &#127;號(hào)碼</td>
              <td nowrap="nowrap" width="110"> &#127;名稱</td>
              <td nowrap="nowrap" width="110"> &#127;日期</td>
              <td nowrap="nowrap" width="110"> &#127;人員</td>
            </tr>
            <tr>
        <td nowrap="nowrap"> &#127;<xsl:value-of select="num"/></td>
        <td nowrap="nowrap"> &#127;<xsl:value-of select="username"/></td>
        <td nowrap="nowrap"> &#127;<xsl:value-of select="dt"/></td>
        <td nowrap="nowrap"> &#127;<xsl:value-of select="men"/></td>
            </tr>
          </table>
        </xsl:template>
        </xsl:stylesheet>

        溫馨提示:喜歡本站的話,請(qǐng)收藏一下本站!

        本類教程下載

        系統(tǒng)下載排行

        主站蜘蛛池模板: 国产精品99久久免费观看| 国产日韩久久免费影院| 亚洲精品无码永久在线观看男男| 国产大陆亚洲精品国产| 亚洲视频免费在线观看| 热99re久久精品精品免费| 亚洲成AV人片在线观看ww| 亚洲AV永久无码精品一福利| 花蝴蝶免费视频在线观看高清版 | 毛片a级毛片免费观看免下载 | 日韩精品免费在线视频| 亚洲精品无码久久一线| 久久亚洲精品高潮综合色a片| 亚洲av激情无码专区在线播放| 亚洲国产精品成人综合色在线婷婷| 一区二区免费在线观看| 久久国内免费视频| 久久精品国产亚洲av麻豆| 窝窝影视午夜看片免费| 亚洲精品你懂的在线观看| 最好看最新的中文字幕免费| 精品亚洲一区二区三区在线播放| 亚洲熟妇无码一区二区三区| 最近新韩国日本免费观看 | 日韩视频免费在线| 亚洲日本在线免费观看| 欧亚精品一区三区免费| 亚洲国产精品白丝在线观看| 免费观看理论片毛片| 一本大道一卡二大卡三卡免费| 国产免费黄色大片| 亚洲一区二区三区亚瑟| 一级毛片**不卡免费播| 亚洲伊人久久大香线焦| 2022久久国产精品免费热麻豆| 亚洲av伊人久久综合密臀性色| 国产va精品免费观看| 亚洲熟妇少妇任你躁在线观看| 亚洲欧洲精品成人久久奇米网| 在线视频网址免费播放| 亚洲一级毛片中文字幕|