This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Paging and Sorting


I don't understand what you mean by:

Mark Nahabedian wrote:
>Somehow, the template which outputs the information about a single
>loan is being executed via another path than the one that wraps a
>table around them.  This might be due to the built-in template which
>matches any element and does <apply-templates/>.
>
>I added explicit templates to shadow this built-in one for some of my
>document's elements.
>
>Another approach would be to use a mode for the path from your table
>to your loan template and have another template for loan (without the
>mode) that does nothing.

I want to be able to display 10 loans per page, allow the user to page 
between the returned loans, and sort the loans in the table by clicking on 
the column titles.

As I mentioned in my last email, when I click the column titles, sorting 
only occurs for the 10 loans listed on the page (and not all the loans 
returned).

Also, the loans that are not being displayed in the table of 10 loans are 
displayed as text above the table.

My XSL and XML are below:

XSL:

<?xml version='1.0'?>
<!-- File sampleLoanSearchLC.xsl-->
<xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' 
version='1.0'>

<xsl:param name="column">
</xsl:param>
<xsl:param name="lowerLimit" select="1">
</xsl:param>
<xsl:param name="upperLimit" select="10">
</xsl:param>


<xsl:variable name="counter">
<xsl:value-of select="count(ReturnResultSet/LoanSearchSet/Loan)"/>
</xsl:variable>

<table>


<tr>

<td>
	<a 
href="/loans/SearchResults.jsp?{'sort=LoanId&amp;upperLimit=10&amp;action=None'}{'&amp;counter='}{$counter}"><b>Loan 
Number</b></a>
</td>

<td>

	<a 
href="/loans/SearchResults.jsp?{'sort=LastName&amp;upperLimit=10&amp;action=None'}{'&amp;counter='}{$counter}"><b>Name</b></a>
</td>

</tr>

<xsl:apply-templates select="ReturnResultSet/LoanSearchSet/Loan">
    <xsl:sort select="LoanId[$column = 'LoanId'] | LoanBorrowerSet[$column = 
'LastName']/Borrower/LastName" />
  </xsl:apply-templates>

</table>

<table>


<tr>

<td>
	<a 
href="/loans/SearchResults.jsp?sort={$column}&amp;upperLimit={$upperLimit}&amp;action=First&amp;counter={$counter}"><b>First 
Page</b></a>
</td>

<td>
	<xsl:if test="$lowerLimit &gt; 1">
	<a 
href="/loans/SearchResults.jsp?sort={$column}&amp;upperLimit={$upperLimit}&amp;action=Previous&amp;counter={$counter}"><b>Previous 
Page</b></a>
	</xsl:if>
</td>
<td>
	<xsl:if test="$counter &gt; $upperLimit">
	<a 
href="/loans/SearchResults.jsp?sort={$column}&amp;upperLimit={$upperLimit}&amp;action=Next&amp;counter={$counter}"><b>Next 
Page</b></a>
	</xsl:if>
</td>

<td>

	<a 
href="/loans/SearchResults.jsp?sort={$column}&amp;upperLimit={$upperLimit}&amp;action=Last&amp;counter={$counter}"><b>Last 
Page</b></a>

</td>

</tr>
</table>
</xsl:template>

<xsl:template match="ReturnResultSet/LoanSearchSet">

  <xsl:apply-templates select="Loan[position() &gt;= $lowerLimit and 
position() &lt;= $upperLimit]"/>
</xsl:template>

<xsl:template match="Loan[position() &gt;= $lowerLimit and position() &lt;= 
$upperLimit]">


  <tr>
  	  <td>
		  <xsl:variable name="loanid">
		  <xsl:value-of select="LoanId"/>
		  </xsl:variable>
		  <a href="/loans/LoanSummary.jsp?{$loanid}">
		  <xsl:value-of select="LoanId"/>
		  </a>
	  </td>

  	  <td>
	  	  <xsl:for-each select="LoanBorrowerSet/Borrower">
		  <xsl:if test="Rank='1'">
		  <xsl:value-of select="LastName"/>
		  </xsl:if>
		  </xsl:for-each>
	  </td>



  </tr>

</xsl:template>

</xsl:stylesheet>


XML:

<ReturnResultSet>
<LoanSearchSet>
<Loan>
<LoanId>123</LoanId>
<LoanBorrowerSet>
<Borrower>
<LastName>Smith</LastName>
</Borrower>
</LoanBorrowerSet>
</Loan>
<Loan>
<LoanId>456</LoanId>
<LoanBorrowerSet>
<Borrower>
<LastName>Jones</LastName>
</Borrower>
</LoanBorrowerSet>
</Loan>
<Loan>
<LoanId>789</LoanId>
<LoanBorrowerSet>
<Borrower>
<LastName>Stills</LastName>
</Borrower>
</LoanBorrowerSet>
</Loan>
...
</LoanSearchSet>
</ReturnResultSet>

-Katie

>From: Mark Nahabedian <naha@ai.mit.edu>
>Reply-To: xsl-list@lists.mulberrytech.com
>To: xsl-list@lists.mulberrytech.com
>Subject: Re: [xsl] Paging and Sorting
>Date: Thu, 18 Oct 2001 17:25:29 -0400
>
>Katie McNally writes:
>[...]
>  > The data is being displayed above the table as:
>  > 9823410-Mar-2001 New 10-Nov-1999 Max Lyons 23492 Jen Masters L 1 Josh
>  > Masters P 2 300 S. State St. 140000.0 TRUE 7.10 13-Aug-2000
>
>Somehow, the template which outputs the information about a single
>loan is being executed via another path than the one that wraps a
>table around them.  This might be due to the built-in template which
>matches any element and does <apply-templates/>.
>
>I had this problem with one of my stylesheets the other day.  I added
>explicit templates to shadow this built-in one for some of my
>document's elements.
>
>Another approach would be to use a mode for the path from your table
>to your loan template and have another template for loan (without the
>mode) that does nothing.
>
>The idea is to make sure that your loan elements are only processed
>within the table you're generating and not any other way.
>
>Sorry I can't give more detail, I don't have your previous messages
>handy.
>
>
>
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>


_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]