Hi all,
I'm having a bit of trouble getting my site to output a certain number of
results per page. Any help on this would be greatly appriciated. Without
this function my code outputs all results on one page and for some queries
there are hundreds of results that take a long time to uotput and wastes a
lot of bandwidth.
Heres a quick rundown on the structure of my site:-
index.html
|
\_/
search1.asp (uses Request.Form to get item, subCat, colour and price from
index.html
| search1.asp opens data.xml and results.xml and passes
the above parameters)
|
\_/
results1.xsl (this file transforms the data.xml)
|
\_/
next1.asp (uses Request.QuerySt ring to get item, subCat, colour, price
and startPos when 'next'
| is clicked)
\_/
results11.xsl (when you click 'next' on this page the parameters are passed
back to next1.asp and so on)
My code is working to some extent as it does show the first 15 results when
you click 'search' on the home page but I get an error when I click next on
that page. see for yourself www.madtim67.com When you do click 'next' the
parameters are being passed if you look in the address bar but for some
reason next1.asp doesn't seem to work correct.
search1.asp
++++++++
<%@ Language="VBScr ipt" %>
<%
dim objDom, fileExists, objFieldValue, objPI
cr1 = Request.Form("i temQuery")
cr2 = Request.Form("S ubCat")
cr3 = Request.Form("c olourQuery")
cr4 = Request.Form("p riceQuery")
set xmlDocument = CreateObject("M SXML2.FreeThrea dedDOMDocument" )
xmlDocument.asy nc="false"
xmlDocument.loa d(Server.MapPat h("db\data.xml" ))
set xslDocument = CreateObject("M SXML2.FreeThrea dedDOMDocument" )
xslDocument.asy nc="false"
xslDocument.loa d(Server.MapPat h("results1.xsl "))
Set XSLTemplate = Server.CreateOb ject("MSXML2.XS LTemplate")
Set XSLTemplate.sty lesheet = xslDocument
Set proc = XSLTemplate.cre ateProcessor()
proc.input = xmlDocument
proc.addParamet er "item1", cr1
proc.addParamet er "subCat1", cr2
proc.addParamet er "colour1", cr3
proc.addParamet er "price1", cr4
proc.output = Response
proc.transform
%>
results1.xsl
++++++++
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:styleshe et
version="1.0"
xmlns:xsl="http ://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="iso-8859-1" />
<xsl:param name="item1" />
<xsl:param name="subCat1" />
<xsl:param name="colour1" />
<xsl:param name="price1" />
<xsl:param name="startPos" select="0" />
<xsl:param name="recordsPe rPage" select="15" />
<xsl:param name="endPos" select="$startP os + $recordsPerPage " />
<xsl:template match="/">
<html>
..
..
..(code that outputs data.xml)
..
..
<a href="javascrip t:history.go(-1)">previous</a> |
<a
href="next1.asp ?item={$item1}% subCat={$subCat 1}%colour={$col our1}%price={$p rice1}%startPos ={$endPos}">nex t</a>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
next1.asp
++++++
<%@ Language="VBScr ipt" %>
<%
dim objDom, fileExists, objFieldValue, objPI
cr1 = Request.QuerySt ring("item")
cr2 = Request.QuerySt ring("subCat")
cr3 = Request.QuerySt ring("colour")
cr4 = Request.QuerySt ring("price")
cr5 = Request.QuerySt ring("startPos" )
set xmlDocument = CreateObject("M SXML2.FreeThrea dedDOMDocument" )
xmlDocument.asy nc="false"
xmlDocument.loa d(Server.MapPat h("db\data.xml" ))
set xslDocument = CreateObject("M SXML2.FreeThrea dedDOMDocument" )
xslDocument.asy nc="false"
xslDocument.loa d(Server.MapPat h("results11.xs l"))
Set XSLTemplate = Server.CreateOb ject("MSXML2.XS LTemplate")
Set XSLTemplate.sty lesheet = xslDocument
Set proc = XSLTemplate.cre ateProcessor()
proc.input = xmlDocument
proc.addParamet er "item1", cr1
proc.addParamet er "subCat1", cr2
proc.addParamet er "colour1", cr3
proc.addParamet er "price1", cr4
proc.addParamet er "startPos", cr5
proc.output = Response
proc.transform
%>
results11.xsl
++++++++
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:styleshe et
version="1.0"
xmlns:xsl="http ://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="iso-8859-1" />
<xsl:param name="item1" />
<xsl:param name="subCat1" />
<xsl:param name="colour1" />
<xsl:param name="price1" />
<xsl:param name="startPos" />
<xsl:param name="recordsPe rPage" select="15" />
<xsl:param name="endPos" select="$startP os + $recordsPerPage " />
<xsl:template match="/">
<html>
..
..
..(code that outputs data.xml)
..
..
<a href="javascrip t:history.go(-1)">previous</a> |
<a
href="next1.asp ?item={$item1}% subCat={$subCat 1}%colour={$col our1}%price={$p rice1}%startPos ={$endPos}">nex t</a>
</body>
</html>
</xsl:template>
</xsl:stylesheet>