Hi all,
thanks for reading this post .
I have a snippet of xslt code that produces a javascript function .I want to be able to put this code in a file and be able able to make a call to this code from different xsl files .Any idea how I do this .I am using xalan processor .
Thanks for your help .
<xsl:variable name="selects">selects.xml</xsl:variable>
<xsl:variable name="cpe"></xsl:variable>
<script language="JavaScript">
function changeCPEType(n) {
alert(" the index is "+ n);
var myArray = new Array(<xsl:for-each select="document ($selects)">
<xsl:for-each select="//select[@name='model']">
<xsl:for-each select="option">
<xsl:variable name="optionValue" select="."/>
<xsl:choose>
<xsl:when test="$optionValue=''">
"<xsl:value-of select="."/>"
</xsl:when>
<xsl:otherwise>
"<xsl:value-of select="."/>",
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:for-each>
</xsl:for-each>);
alert("value of myArray is "+myArray[n]);
}
</script>