Passing option value to javascript in XSL

admin

Administrator
Staff member
Hello

I am trying to pass an option value to some javascript which should then pass it to another stylesheet. I can pass the parameter if I manually assign it a value in the javascript, but I cant get it to pick it up from my xsl code. I keep getting runtime error - type mismatch. Any advice would be most appreciated please!!!! Thanks
Here is the code:

<?xml version="1.0"?>
<etc...>
<html>
<body>

<select id="festivalName" onChange="festivalName()">
<option value=http://www.webdeveloper.com/forum/archive/index.php/"">Select a festival</option>
<xsl:for-each select="website/festival/festivalName">
<option value="{.}">
<xsl:value-of select="."/>
</option>
</xsl:for-each>
</select>

<script language="Javascript"><![CDATA[
function festivalName() {
var xslt = new ActiveXObject("Msxml2.XSLTemplate");
var xslDoc = new ActiveXObject("Msxml2.FreeThreadedDOMDocument");
var xslProc;
var x = festivalName.value;
xslDoc.async = false;
xslDoc.resolveExternals = false;
xslDoc.load("festivalName.xsl");
xslt.stylesheet = xslDoc;

var xmlDoc = new ActiveXObject("Msxml2.DOMDocument");
xmlDoc.async = false;
xmlDoc.resolveExternals = false
xmlDoc.load("festival.xml");
xslProc = xslt.createProcessor();
xslProc.input = xmlDoc;
xslProc.addParameter("x", x);
xslProc.transform();
document.write(xslProc.output);}
]]></script>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
 
Back
Top