Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <xsl:variable name="numberOfRecords" select="count(/upkeepList/upkShare)"/>
- <xsl:variable name="upkshr">
- <xsl:for-each select="*/upkShare">
- <upkp pstdte="{@post_dte}" rltedmnthyr = "{@month_year}" ob = "{format-number(OpngBlnce, '#', 'coerce')}"
- mcamnt = "{format-number(mnthCrrntAmnt, '#','coerce')}" term = "{@due}" rcptsum = "{format-number(sum(Rcpt/amnt), '#','coerce')}" />
- </xsl:for-each>
- </xsl:variable>
- <xsl:param name="size" select="4"/>
- <xsl:template match="/">
- <xsl:variable name="upkp-set" select="exsl:node-set($upkshr)/upkp"/>
- <html>
- <head>
- <h3 style="margin-left:320">Upkeep share bills list</h3>
- </head>
- <body>
- <xsl:apply-templates select="$upkp-set[position() mod $size = 1]">
- <xsl:with-param name="pages" select="ceiling(count($upkp-set) div $size)"/>
- <xsl:with-param name="numberOfRecords" select="$numberOfRecords"/>
- </xsl:apply-templates>
- </body>
- </html>
- </xsl:template>
- <xsl:template match="upkp">
- <xsl:param name="pages"/>
- <xsl:param name="numberOfRecords"/>
- <xsl:variable name="page" select="position()"/>
- <table border="1" id='content{$page - 1}' width="80px" height="170" style="text-align:center;">
- <tr>
- <th>UpkpShare_Prd</th> <th>PostDate</th> <th>InitBalance</th>
- <th>UpkpShare_Amnt</th>
- <th>DueDate</th> <th>FullAmnt</th> <th>FullAmntPayed</th>
- <th>AmntDue</th>
- </tr>
- <xsl:for-each select=". | following-sibling::upkp[position()<$size]">
- <xsl:variable name="initblnc" select="sum(preceding-sibling::upkp/@ob) + sum(preceding-sibling::upkp/@mcamnt) - sum(preceding-sibling::upkp/@rcptsum) + @ob"/>
- <tr>
- <td><div style="auto"> <xsl:value-of select="@rltedmnthyr"/>
- </div></td>
- <td> <xsl:value-of select="@pstdte"/> </td>
- <td> <div style="width:30px">
- <xsl:value-of select="$initblnc"/>
- </div>
- </td>
- <td> <xsl:value-of select="@mcamnt"/> </td>
- <td> <div style="width:60px"> <xsl:value-of select="@term"/> </div> </td>
- <td> <xsl:value-of select="$initblnc + @mcamnt"/> </td>
- <td> <xsl:value-of select="@rcptsum"/> </td>
- <td> <xsl:value-of select="$initblnc + @mcamnt - @rcptsum"/> </td>
- </tr>
- </xsl:for-each>
- <tr>
- <td colspan="8">
- <xsl:call-template name="s">
- <xsl:with-param name="numberOfRecords" select="$numberOfRecords" />
- <xsl:with-param name="currentPage" select="$page - 1" />
- <xsl:with-param name="recordsPerPage" select="$size" />
- </xsl:call-template>
- </td> </tr>
- </table>
- </xsl:template>
- <!-- that site's pagination starts from here -->
- <xsl:param name="currentPage"/>
- <xsl:template name="s">
- <!--<xsl:param name="currentPage"/> -->
- <xsl:param name="numberOfRecords"/>
- <xsl:param name="recordsPerPage"/>
- <xsl:variable name="pageNumber">
- <xsl:choose>
- <!-- first page -->
- <xsl:when test="$currentPage <= 0 or $currentPage = '' or $currentPage = 'NaN'">0</xsl:when>
- <!-- what was passed in -->
- <xsl:otherwise>
- <xsl:value-of select="$currentPage"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <!-- The fun starts here -->
- <ul class="listing self-clear">
- <xsl:for-each select="//item">
- <xsl:if test="position() > $recordsPerPage * number($pageNumber) and position() <= number($recordsPerPage * number($pageNumber) + $recordsPerPage )">
- <li>
- <xsl:attribute name="class">
- <xsl:if test="position() = $recordsPerPage * (number($pageNumber) + 1)">last</xsl:if>
- </xsl:attribute>
- <h4> <!--<a href="?p={position()}">--> <xsl:value-of select="text()"/> <!--</a> -->
- </h4>
- </li>
- </xsl:if>
- </xsl:for-each>
- </ul>
- <xsl:call-template name="pagination">
- <xsl:with-param name="pageNumber" select="$pageNumber"/>
- <xsl:with-param name="recordsPerPage" select="$recordsPerPage"/>
- <xsl:with-param name="numberOfRecords" select="$numberOfRecords"/>
- </xsl:call-template>
- </xsl:template>
- <xsl:template name="pagination">
- <xsl:param name="pageNumber"/>
- <xsl:param name="recordsPerPage"/>
- <xsl:param name="numberOfRecords"/>
- <div class="pagination">
- <div class="wrapper">
- <xsl:if test="(($pageNumber +1) * $recordsPerPage) < ($numberOfRecords)">
- <a href="#{$pageNumber + 1}" class="next" onclick="nextPage({$pageNumber + 1})">Next</a>
- <xsl:text> </xsl:text>
- </xsl:if>
- <xsl:if test="$pageNumber > 0">
- <xsl:text> </xsl:text>
- <a href="#{$pageNumber -1}" class="prev" onclick="prevPage({$pageNumber - 1})">Prev</a>
- </xsl:if>
- <xsl:text> </xsl:text>
- <span class="page-nos">Page
- <xsl:call-template name="for.loop">
- <xsl:with-param name="i"> 1 </xsl:with-param>
- <xsl:with-param name="page" select="$pageNumber +1"/>
- <xsl:with-param name="count" select="ceiling(count(//item)div $recordsPerPage)"/>
- </xsl:call-template>
- </span>
- </div>
- </div>
- </xsl:template>
- <xsl:template name="for.loop">
- <xsl:param name="i"/>
- <xsl:param name="count"/>
- <xsl:param name="page"/>
- <xsl:if test="$i <= $count">
- <span>
- <xsl:if test="$page != $i">
- <a href="?page={$currentPage}"> <xsl:value-of select="$i"/> </a>
- </xsl:if>
- <xsl:if test="$page = $i">
- <xsl:value-of select="$i"/>
- </xsl:if>
- </span>
- </xsl:if>
- <xsl:if test="$i <= $count">
- <xsl:call-template name="for.loop">
- <xsl:with-param name="i">
- <xsl:value-of select="$i + 1"/>
- </xsl:with-param>
- <xsl:with-param name="count">
- <xsl:value-of select="$count"/>
- </xsl:with-param>
- <xsl:with-param name="page">
- <xsl:value-of select="$page"/>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:if>
- </xsl:template>
- </xsl:stylesheet>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement