Re: [xsl] How to display XML data partially

Subject: Re: [xsl] How to display XML data partially
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Fri, 23 Mar 2001 11:54:04 +0000
Hi Davut,

> I am generating the page dynamically. More clearly I wanted to
> define an xsl parameter startNode pointing to the first of a 10
> device block. Then incremet it by 10 everytime a user clicks a
> "Next" button or hyperlink.
>
> However I was not able to increment the parameter.

You need to pass the new value of the parameter into the stylesheet.
How you do that depends on the processor that you're using to process
the stylesheet - I guess you're either doing a client-side transform
with MSXML or a server-side transform with Cocoon.

If you're doing the transform with Cocoon, then you can pass
parameters using the URL that you have with the link.  So the URL:

  devices.xml?startNode=1

will set the $startNode parameter to 1.  So if you're using Cocoon
it's just a matter of generating this URL dynamically with an
attribute value template:

  <a href="devices.xml?startNode={$startNode + 10}">Next</a>

If you're doing the transform with MSXML, then to use parameters you
need a script that manages the transform - takes the data, takes the
stylesheet, creates DOMs and XSLTemplate objects and so on.  Have a
look at the MSXML SDK (loop up setParameter) for details.  Then it's a
matter of creating the Javascript on the output page that you're
generating, i.e. create the script element:

  <script type="text/javascript">
     function loadNextPage(index) {
        ...
        processor.setParameter('startNode', index);
        ...
     }
  </script>

Then later on create the a element that, when clicked, calls this
function.  You can use an attribute value template within the
'onclick' attribute to identify the index that should be passed to the
function:

  <a onclick="loadNextPage({$startNode + 10})">Next</a>

I hope that helps,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/



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


Current Thread