20 results per page

Discussion in 'XML' started by thomas, Oct 28, 2005.

  1. thomas

    thomas Guest

    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">
    <xsl:eek:utput method="html"/>

    <xsl:param name="startPos" select="1"/>
    <xsl:param name="recordsPerPage" select="20"/>
    <xsl:param 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>
    thomas, Oct 28, 2005
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?S01aX3N0YXRl?=

    Quick one - Is SESSION per browser instance or per IP Address?

    =?Utf-8?B?S01aX3N0YXRl?=, Apr 4, 2006, in forum: ASP .Net
    Replies:
    7
    Views:
    5,861
    gerry
    Apr 10, 2006
  2. Razvan
    Replies:
    1
    Views:
    402
    tony vee
    Sep 10, 2004
  3. Replies:
    5
    Views:
    2,519
  4. Replies:
    0
    Views:
    339
  5. chris brat
    Replies:
    1
    Views:
    615
    chris brat
    May 10, 2006
Loading...

Share This Page