This is my XML file,
---------------------------------------XML File------------------------------------------
- <?xml version = "1.0"?><!-- DWXMLSource=world.xml" -->
-
-
<!-- reference XSL stylesheet URI -->
-
<xsl:stylesheet version = "1.0"
-
xmlns:xsl = "http://www.w3.org/1999/XSL/Transform">
-
-
<xsl:output method = "html" omit-xml-declaration = "no"
-
doctype-system =
-
"http://www.w3c.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
-
doctype-public = "-//W3C//DTD XHTML 1.0 Strict//EN"/>
-
-
<xsl:template match = "/"> <!-- match root element -->
-
-
<html xmlns="http://www.w3.org/1999/xhtml">
-
-
<head>
-
<title>world</title>
-
</head>
-
<script language="javascript">
-
-
function show1(cval)
-
{
-
var choice = document.formname.drop1.options[document.formname.drop1.selectedIndex].value;
-
alert("choice:"+choice)
-
alert("test1:"+cval);
-
alert(<xsl:value-of select = "@id"/>)
-
-
}
-
function show(cva)
-
{
-
alert("test2:"+cva);
-
-
}
-
</script>
-
<body>
-
-
-
-
<form name="formname">
-
<select name="drop1" onchange="show1()">
-
<xsl:for-each select = "world/country/state">
-
<option><xsl:value-of select = "city"/></option>
-
</xsl:for-each>
-
</select>
-
</form>
-
-
<form name="formname1">
-
<select name="drop12" onchange="javascript: show(this.value)">
-
<xsl:for-each select = "world/country/state">
-
-
<option ><xsl:value-of select = "@id"/></option>
-
</xsl:for-each>
-
</select>
-
</form>
-
-
</body>
-
-
</html>
-
-
</xsl:template>
-
-
</xsl:stylesheet>
-
---------------------------------------XML File------------------------------------------
and this HTML
--------------------------------------HTML file------------------------------------------
[HTML]<html>
<body>
<script language="javascript">
var xmlDoc = new ActiveXObject("Microsoft.XMLDOM")
xmlDoc.async="false"
xmlDoc.load("world.xml")//loading an XML file
document.write("<table><tr><td>")
//fetching the values of the tag "country"
var y=xmlDoc.getElementsByTagName('country')
document.write("<td><select size='2' multiple='multiple' onchange='show(this.value)'>");
for (i=0;i<y.length;i++)
{
document.write("<option value="+(i+1)+">")
document.write(y[i].childNodes[0].nodeValue)
document.write("<br />")
document.write("</option>")
}
document.write("</select></td>")
function show(u)
{
document.all['ss'].style.display = 'block';
}
document.write("<td><div id='ss' style='display:none;'>")
var z=xmlDoc.getElementsByTagName('state')//fetching the values of the tag "state"
document.write("<select size='3' multiple='multiple' onchange='show1(this.value)'>");
for (i=0;i<z.length;i++)
{
document.write("<option value="+(i+1)+">")
document.write(z[i].childNodes[0].nodeValue)
document.write("<br />")
document.write("</option>")
}
document.write("</select>")
document.write("</div></td>")
function show1(u)
{
var r=u
document.all['ss1'].style.display = 'block';
}
document.write("<td><div id='ss1' style='display:none;'>")
var s=xmlDoc.getElementsByTagName('city')//fetching the values of the tag "city"
document.write("<select size='4' multiple='multiple' >");
for (i=0;i<s.length;i++)
{
document.write("<option>")
document.write(s[i].childNodes[0].nodeValue)
document.write("<br />")
document.write("</option>")
}
document.write("</select>")
document.write("</div></td></tr></table>")
</script>
</body>
</html>
[/HTML]--------------------------------------HTML file------------------------------------------
Here iam putting two files with this post,
one is XML file...
other is HTML file..
in this example , i can fetch the values from XML file and presented them
in three drop down lists..
offcourse they r connected... but i need to connect them as, when i
selected one option in first list, second list has to be filled with the
first option's corresponding values like that for third list also...
Have a look at these files and send me reply........
Expecting a favourable reply...
Thanks and Regards,
ift40458