This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: How to display XML data partially
- To: Davut Karabay <dkarabay at yahoo dot com>
- Subject: Re: [xsl] How to display XML data partially
- From: Jeni Tennison <mail at jenitennison dot com>
- Date: Fri, 23 Mar 2001 11:54:04 +0000
- CC: xsl-list at lists dot mulberrytech dot com
- Organization: Jeni Tennison Consulting Ltd
- References: <20010322054550.4818.qmail@web1602.mail.yahoo.com>
- Reply-To: xsl-list at lists dot mulberrytech dot com
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