Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: how can I use javascript to set xsl:param?

From: Martin Honnen <mahotrash@-----.-->
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/


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent