Click here to Skip to main content
15,887,485 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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>
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900