Xslt分页问题 [英] Xslt pagination issue

查看:58
本文介绍了Xslt分页问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您的xslt代码如下所示,我想在每个页面中显示20个结果。任何人都可以告诉我为什么我下面编写的代码不起作用。请帮忙。



我尝试过的事情:



我试过这个,但这不起作用。

< a href =>< / a>< pre>< / pre>< xsl:stylesheet xmlns:xsl =http ://www.w3.org/1999/XSL/Transformversion =1.0>



< xsl:output method =htmlindent = 是omit-xml-declaration =是/>

< xsl:param name =Page/>

< xsl:param name =PageSize/>

< xsl:param name =PageURL/>



< xsl:模板名称=resultsmatch =/>

< xsl:variable name =mycountselect =count(root / Keyword_Details)/>

< xsl:variable name =selectedRowCountselect =floor((number($ mycount)-1)div $ PageSize)+1/>



<! - 分页逻辑 - >

< xsl:for-each select =root / Keyword_Details>

< xsl:if test = position()& gt; =($ Page * $ PageSize)+ 1>

< xsl:if test =position()& lt; = $ PageSize +($ PageSize * $ Page)>

< div class = alternative_clsstyle =padding-left:30px; padding-top:1px; padding-bottom:0.5px; width = 500px>





< a style =text -decoration:nonehref =http:// {link}target =_ blank>



< br />



< div style =float:left; font-family:Times New Roman>

< strong>





< xsl:value-of select =casename/>



(< ; xsl:value-of select =date/>)



< / strong>

< / div> < br $> b $ b

< br />



< div style =float:left; font-family :Times New Roman>

< xsl:value-of select =docket/>

< / div>



< br />



< div style =float:left; font-family:Times New Roman>

< xsl:value-of select =court/>

< / div>



< br />

< br />

< br />

< / a>



< / div>



< / xsl:if>

< / xsl:if>

< / xsl:for-each>

<! - 结束分页逻辑 - >





<! - 分页的上传链接 - >

< xsl:choose>

< xsl:当test =number($ Page)-1& gt; = 0>

&#160;

< A>

< xsl:attribute name =href>

< xsl:value-of select =$ PageURL/>?page =< xsl:value -of select =number($ Page)-1/>& amp; pagesize =< xsl:value-of select =$ PageSize/>

< / xsl :attribute>

& lt;& lt;上一页

< / A>

< / xsl:when>



< / xsl:选择>

<! - 分页的上传链接 - >



< xsl:if test =$ selectedRowCount& gt; 1>

&#160;< b class =blacktext>

< xsl:value-of select =number($ Page) +1/>&#160;&#160;< xsl:value-of select =number($ selectedRowCount)/>

< / b>& #160;

< / xsl:if>

<! - 分页的下一个链接 - >

< xsl :选择>

< xsl:当test =number($ Page)+1& lt; number($ selectedRowCount)>

&#160;

< A>

< xsl:attribute name =href >

< xsl:value-of select =$ PageURL/>?page =< xsl:value-of select =number($ Page)+1/> ;& amp; pagesize =< xsl:value-of select =$ PageSize/>

< / xsl:attribute>

Next& gt; & gt;

< / A>

< / xsl:when>



< / xsl:选择>



< / xsl:template>



< / xsl:stylesheet> ;

Hi my xslt code is as below, I want 20 results to be displayed in each page.Can anybody tell me why my code written below is not working. Please help.

What I have tried:

I have tried this, but this is not working.
<a href=""></a><pre></pre><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

<xsl:output method="html" indent="yes" omit-xml-declaration="yes" />
<xsl:param name="Page" />
<xsl:param name="PageSize"/>
<xsl:param name="PageURL"/>

<xsl:template name="results" match="/">
<xsl:variable name="mycount" select="count(root/Keyword_Details)"/>
<xsl:variable name="selectedRowCount" select="floor((number($mycount)-1) div $PageSize)+1"/>

<!-- Pagination logic -->
<xsl:for-each select="root/Keyword_Details">
<xsl:if test="position() &gt;= ($Page * $PageSize) + 1">
<xsl:if test="position() &lt;= $PageSize + ($PageSize * $Page)">
<div class="alternative_cls" style="padding-left: 30px; padding-top:1px;padding-bottom:0.5px;width=500px" >


<a style="text-decoration:none" href="http://{link}" target="_blank">

<br/>

<div style= "float:left;font-family: Times New Roman">
<strong>


<xsl:value-of select="casename" />

(<xsl:value-of select="date" />)

</strong>
</div>

<br/>

<div style= "float:left;font-family: Times New Roman">
<xsl:value-of select="docket" />
</div>

<br/>

<div style= "float:left;font-family: Times New Roman">
<xsl:value-of select="court" />
</div>

<br/>
<br/>
<br/>
</a>

</div>

</xsl:if>
</xsl:if>
</xsl:for-each>
<!--End Pagination logic -->


<!-- Prev link for pagination -->
<xsl:choose>
<xsl:when test="number($Page)-1 &gt;= 0">
&#160;
<A>
<xsl:attribute name="href">
<xsl:value-of select="$PageURL"/>?page=<xsl:value-of select="number($Page)-1"/>&amp;pagesize=<xsl:value-of select="$PageSize"/>
</xsl:attribute>
&lt;&lt;Prev
</A>
</xsl:when>

</xsl:choose>
<!-- Prev link for pagination -->

<xsl:if test="$selectedRowCount &gt; 1">
&#160;<b class="blacktext">
<xsl:value-of select="number($Page)+1"/>&#160;of&#160;<xsl:value-of select="number($selectedRowCount)"/>
</b>&#160;
</xsl:if>
<!-- Next link for pagination -->
<xsl:choose>
<xsl:when test="number($Page)+1 &lt; number($selectedRowCount)">
&#160;
<A>
<xsl:attribute name="href">
<xsl:value-of select="$PageURL"/>?page=<xsl:value-of select="number($Page)+1"/>&amp;pagesize=<xsl:value-of select="$PageSize"/>
</xsl:attribute>
Next&gt;&gt;
</A>
</xsl:when>

</xsl:choose>

</xsl:template>

</xsl:stylesheet>

推荐答案

mycount)-1)div
mycount)-1) div


PageSize)+1/>



<! - 分页逻辑 - >

< xsl:for-each select =root / Keyword_Details>

< xsl:if test =position()& gt; =(
PageSize)+1"/>

<!-- Pagination logic -->
<xsl:for-each select="root/Keyword_Details">
<xsl:if test="position() &gt;= (


Page *


这篇关于Xslt分页问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆