T
thomas
Hi all,
I was wandering is anyone can help. When I click on the 'view all' link on
my homepage http://www.guitarmidi.co.uk I woild like to output the first 20
results on screen then have a 'next' link at the bottom of the page and when
I click on that, the next 20 results are shown on screen and so on. When I
click the 'view all' link, the view .asp page opens the data.xml and
view.xsl pages but the xsl page isn't outputing the results.
I think it is something to do with the line below from the xsl page because
when I use <xsl:for-each select="cat/links"> all the results are output but
on the same page.
<xsl:for-each select="cat/links[position() >= $startPos and position() <=
$endPos]">
Anybody any ideas on what i'm doing wrong?
view.asp
======
<%@ Language="VBScript" %>
<%
dim objDom, fileExists, objFieldValue, objPI
set xmlDocument = CreateObject("MSXML2.FreeThreadedDOMDocument")
xmlDocument.async="false"
xmlDocument.load(Server.MapPath("db/data.xml"))
set xslDocument = CreateObject("MSXML2.FreeThreadedDOMDocument")
xslDocument.async="false"
xslDocument.load(Server.MapPath("view.xsl"))
Set XSLTemplate = Server.CreateObject("MSXML2.XSLTemplate")
Set XSLTemplate.stylesheet = xslDocument
Set proc = XSLTemplate.createProcessor()
proc.input = xmlDocument
proc.Transform
Response.Write proc.output
%>
view.xsl
======
<?xml version="1.0"?>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xslutput method="html"/>
<xslaram name="startPos" select="1"/>
<xslaram name="recordsPerPage" select="20"/>
<xslaram name="endPos" select="$startPos + $recordsPerPage"/>
<xsl:template match="/">
<html>
<head>
<link rel="stylesheet" type="text/css" href="mystyle.css" />
<title>Results</title>
</head>
<body>
<table class="three" align="center">
<col width="40%"/>
<col width="40%"/>
<col width="10%"/>
<col width="10%"/>
<tr>
<th class="head1">Artist</th>
<th class="head1">Song</th>
<th class="head">Chord</th>
<th class="head">Midi</th>
</tr>
<xsl:for-each select="cat/links[position() >= $startPos and position() <=
$endPos]">
<xsl:sort select="artist"/>
<tr>
<td class="one"><xsl:apply-templates select="./artist"/></td>
<td class="one"><xsl:apply-templates select="./song"/></td>
<xsl:variable name="path1"><xsl:apply-templates
select="./path"/></xsl:variable>
<td><a href="media/{$path1}.txt" target="_blank">view</a></td>
<td><a href="media/{$path1}.mid">play</a></td>
</tr>
</xsl:for-each>
</table>
<a href="javascript:history.go(-1)">previous</a> |
<a href="next.asp?startPos={$endPos}">next</a>
<p></p>
<a href="index.html">Click here to return to search page</a>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
I was wandering is anyone can help. When I click on the 'view all' link on
my homepage http://www.guitarmidi.co.uk I woild like to output the first 20
results on screen then have a 'next' link at the bottom of the page and when
I click on that, the next 20 results are shown on screen and so on. When I
click the 'view all' link, the view .asp page opens the data.xml and
view.xsl pages but the xsl page isn't outputing the results.
I think it is something to do with the line below from the xsl page because
when I use <xsl:for-each select="cat/links"> all the results are output but
on the same page.
<xsl:for-each select="cat/links[position() >= $startPos and position() <=
$endPos]">
Anybody any ideas on what i'm doing wrong?
view.asp
======
<%@ Language="VBScript" %>
<%
dim objDom, fileExists, objFieldValue, objPI
set xmlDocument = CreateObject("MSXML2.FreeThreadedDOMDocument")
xmlDocument.async="false"
xmlDocument.load(Server.MapPath("db/data.xml"))
set xslDocument = CreateObject("MSXML2.FreeThreadedDOMDocument")
xslDocument.async="false"
xslDocument.load(Server.MapPath("view.xsl"))
Set XSLTemplate = Server.CreateObject("MSXML2.XSLTemplate")
Set XSLTemplate.stylesheet = xslDocument
Set proc = XSLTemplate.createProcessor()
proc.input = xmlDocument
proc.Transform
Response.Write proc.output
%>
view.xsl
======
<?xml version="1.0"?>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xslutput method="html"/>
<xslaram name="startPos" select="1"/>
<xslaram name="recordsPerPage" select="20"/>
<xslaram name="endPos" select="$startPos + $recordsPerPage"/>
<xsl:template match="/">
<html>
<head>
<link rel="stylesheet" type="text/css" href="mystyle.css" />
<title>Results</title>
</head>
<body>
<table class="three" align="center">
<col width="40%"/>
<col width="40%"/>
<col width="10%"/>
<col width="10%"/>
<tr>
<th class="head1">Artist</th>
<th class="head1">Song</th>
<th class="head">Chord</th>
<th class="head">Midi</th>
</tr>
<xsl:for-each select="cat/links[position() >= $startPos and position() <=
$endPos]">
<xsl:sort select="artist"/>
<tr>
<td class="one"><xsl:apply-templates select="./artist"/></td>
<td class="one"><xsl:apply-templates select="./song"/></td>
<xsl:variable name="path1"><xsl:apply-templates
select="./path"/></xsl:variable>
<td><a href="media/{$path1}.txt" target="_blank">view</a></td>
<td><a href="media/{$path1}.mid">play</a></td>
</tr>
</xsl:for-each>
</table>
<a href="javascript:history.go(-1)">previous</a> |
<a href="next.asp?startPos={$endPos}">next</a>
<p></p>
<a href="index.html">Click here to return to search page</a>
</body>
</html>
</xsl:template>
</xsl:stylesheet>