Re: [xsl] Parsing a List

Subject: Re: [xsl] Parsing a List
From: Joerg Heinicke <joerg.heinicke@xxxxxx>
Date: Wed, 22 May 2002 15:12:11 +0200
Hello Ken,

the question is, what fremwork you are using. How can you pass the parameter to the stylesheet. It's not possible with pure XSLT 1.0. Either you need something like a servlet or a javascript/xslt-framework for example with Internet Explorer.

Then there could be a link like

<a href="list.html?first={$first - $count}&amp;count={$count}">previous</a>

and

<a href="list.html?first={$first + $count}&amp;count={$count}">next</a>


Joerg



kenneth.howlin@xxxxxxxxxx wrote:
Excellent Joreg......thanks a million.

Any idea how I can get the "next 50" and "previous 50" links to work.

Thanks again
ken
>
>

mail from Joerg Heinicke


Hello Kenneth,

you can pass parameters to the stylesheet. In your case for example the
number of the first element to show in the list:

<xsl:param name="first" select="1"/>
<xsl:param name="count" select="50"/>

 > <xsl:template match="DATALIST">
 > <table cellpadding="5" cellspacing="0" border="0">
 > <tr>
 >   <td width="135"><u><font color="green">Company</font></u></td>
 >   <td width="330"><u><font color="green">Address </font></u></td>
 >   <td width="100"><u><font color="green">Phone </font></u></td>
 > <td width="100"></td>
 > </tr>
 >   <xsl:apply-templates select="customer"/>

changed to:
<xsl:apply-templates select="customer[position() >= $first][position()
&lt;= $count]"/>

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

<xsl:template match="customer">

<tr>
<td valign="top"><a><xsl:attribute name="href">
adminViewCompanyByID?companyid=<xsl:value-of select="id"/>

&#38;companyname


=<xsl:value-of select="invoicename"/></xsl:attribute><xsl:value-of select

="


invoicename"/></a></td>
<td valign="top"><xsl:value-of select="invoiceaddress"/></td>
<td valign="top"><xsl:value-of select="phone"/></td>
</tr>
</xsl:template>

Simply, all this code does is displays all customers contained in the
database. However my problem is that I have 1000s of customers in the
database and as a result all these are returned in one huge list. My web
page is therefore ridicously wrong.

Does anyone know anyway of displaying say 50 Customers at a time with a
'next' and "previous" link to display  the next or previous 50.

Any help would be greatly appreciated.

Thanks
- ken


Regards,

Joerg


--

System Development
VIRBUS AG
Fon  +49(0)341-979-7419
Fax  +49(0)341-979-7409
joerg.heinicke@xxxxxxxxx
www.virbus.de


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



Current Thread