This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: XSL navigation


Hi Varada,

> At a time i want to display only five records from xml file and and
> on click event i would like to go for next 5 records.
>
> For this i need to access a hidden html element in an xsl. Is it
> possible? and i want to use a xsl:value of to pass a parameters to
> javascript called on 'onClick' event of a html button object. Is it
> possible?

I can think of two main ways that you could do this.

The first involves a single transformation that generates an HTML file
that contains all the rows, but uses CSS to keep some of the rows
hidden. When you click on the button, you can use JavaScript (or
something) to change the style of the rows so that different ones show
or are hidden.

This should be quite easy to do, although may have different results
in different browsers because of variable CSS support. If you want to
pursue this solution, you should create working HTML first, and then
work out how to generate that HTML from your stylesheet -- you can
generate onclick attributes and script content in just the same way as
you can any other attributes or content, XSLT doesn't know the
difference.

The second method involves doing several transformations, each giving
different portions of the XML based on a parameter passed to the
stylesheet. To do this, you need to make sure that your stylesheet
accepts a parameter that can determine which rows to display from the
source XML. Then it depends on whether you're doing a client-side or
server-side transformation.

With a client-side transformation, you need to write a JavaScript (or
something) script to perform the transformation using that stylesheet,
with a function that passes a parameter into the stylesheet (using the
.addParameter method). You need to reference that script in the HTML
document that you create from your stylesheet, and include the
relevant JavaScript for calling your function within the HTML that you
generate.

With a server-side transformation, you need to make sure that the
servlet that you're using is configured correctly, so that it can pass
parameters through to the stylesheet, and then adjust the links in the
HTML generated by your stylesheet so that the correct parameter is
passed through each time.

Either way, the issue is not so much in the XSLT stylesheet itself but
rather how you activate the stylesheet. If you need more detail on any
of the methods, let us know.

Cheers,

Jeni

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


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]