File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes HTML, CSS and JavaScript and the fly likes xsl in javascript Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "xsl in javascript" Watch "xsl in javascript" New topic

xsl in javascript

Nazneen Shaikh

Joined: May 01, 2003
Posts: 21

I am currently working on xsl/xml. I have to implement 2 related dropdown select boxes. I get the data as a jdbc resultset which i can very easily parse with <xsl:for-each> consruct. I want to use this in the javascript so that when ever i call the onchange method from the country drop-down the state drop-down will be re-populated with states of the country selected.

i need to implement something like this

var selcountry=doc.form.selCountry.value;
when xsl of statecountry=selcountry

Pls tell me how can i do it, and the syntax for the same please.....
Eric Pascarello

Joined: Nov 08, 2001
Posts: 15385
problem is the xsl is fired before the page is loaded so you would have to reload the page to fill in the second list. You may want to look into an Ajax solution where you can use a transformation, get the values and fill it in.

Nazneen Shaikh

Joined: May 01, 2003
Posts: 21

I have managed to get the country and states in two different array, and have a a javascript to populate the state select on the basis of the selected country.
The problem that i am facing now is since on page load, the state select box is not populated with any of the states but a default value of "select state" after i have submitted the page and i go to the next page, if from the next i try to come back(history.go(-1)) the value of the state selected earlier is lost, the list is not populated though the country is selected, i get the populated state list, I need to select a different country and then re-select the original one
please help.
I tried putting in a hidden field, and i am storing the value of the selected state ithis hidden field and i am trying to put in a javascript on the basis of that, but even this hidden field value is reset to null on back.
Please help
Thanking in advance
Nazneen Shaikh

Joined: May 01, 2003
Posts: 21
gotcha...this topic may be closed
Managed it with div's
I agree. Here's the link:
subject: xsl in javascript
It's not a secret anymore!