Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - how can I use javascript to set xsl:param? [Thread Next] Re: how can I use javascript to set xsl:param?To: NULL Date: 9/9/2008 12:52:00 PM
bgraves wrote:
> I get a error ("GetCheckboxes() is an unknown XSLT function") when I
> do this:
>
> <xsl:param name="ProdIDs">
> <script type="text/javascript" Language="JavaScript">
> <![CDATA[
> function GetCheckboxes(f)
> {
> for(var i = 0;i<f.Compare.length;i++)
> {
> if(f.Compare[i].checked)
> {
> tempArr[tempArr.length] = f.Compare[i].value //if checked, get value
> }
> }
> return tempArr
> }
> ]]>
> </script>
> <xsl:value-of select="CheckCheckboxes(this)"/>
> </xsl:param>
Based on your script code it appears as if that function is supposed to
script against the HTML DOM object model of form elements yet later on
you seem to try to call that function from an XPath expression in your
stylesheet. So you confuse script in a HTML document with script in an
XSLT stylesheet. Both are possible and as a HTML document can be the
result of an XSLT stylesheet it is even possible that both approaches
appear in the same stylesheet. Nevertheless both approaches are complete
seperated, a function exposed to XSLT/XPath is not exposed to HTML
script and vice versa.
So you need to decide what you want/need, with MSXML you can use script
and the msxsl:script element to write extension functions for your XSLT
stylesheet, and with IE and other browsers you can use the HTML script
element to implement script functions to be called by the browser, for
instance in response to an onclick or onsubmit event handler.
--
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
