Firstly, here is my XML file:
My XSLT:Code:<?xml version="1.0" encoding="iso-8859-1"?> <?xml-stylesheet type="text/xsl" href="sound.xsl"?> <sound> <sample> <title>sample1</title> <url>http://www.example.com/sample1.mp3</url> </sample> <sample> <title>sample2</title> <url>http://www.example.com/sample2.mp3</url> </sample> </sound>
I need to pass the value of the combo box to the Listen.php file. How do I access that value in the combo box?Code:<?xml version="1.0" encoding="iso-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <html> <head> <script type="text/javascript"> function Listen() { var x; var width = 500; var height = 350; var left = (screen.width - width)/2; var top = (screen.height - height)/2; var params = 'width='+width+', height='+height; params += ', top='+top+', left='+left; params += ', directories=no'; params += ', location=no'; params += ', menubar=no'; params += ', resizable=no'; params += ', scrollbars=no'; params += ', status=no'; params += ', toolbar=no'; x=document.forms[0].sel_Sounds.value; //Modify this part url="Listen.php?ID="+x; newwin=window.open(url,'Listen', params); if (window.focus) { newwin.focus() } return false; } </script> </head> <body> <form> <table border="0" align="center"> <tr> <td> <select id="sel_Sounds"> <xsl:for-each select="sound/sample"> <option> <xsl:attribute name="value"><xsl:value-of select="url"/></xsl:attribute> <xsl:value-of select="title"/> </option> </xsl:for-each> </select> </td> </tr> <tr align="center"> <td> <input type="button" value="Listen" onClick="Listen();"/> </td> </tr> </table> </form> </body> </html> </xsl:template> </xsl:stylesheet>




Reply With Quote