Re: [xsl] Pass a variable value from javascript to xsl

Subject: Re: [xsl] Pass a variable value from javascript to xsl
From: Colin Paul Adams <colin@xxxxxxxxxxxxxxxxxx>
Date: 07 Apr 2005 13:45:55 +0100
>>>>> "ohtar" == ohtar  <enrech@xxxxxxxxx> writes:

    ohtar> I am trying to pass a variable value from javascript to
    ohtar> xsl. For example, I have a xsl:variable called instance:
 
 
    ohtar>  <xsl:variable name="instance"/>
 
 
    ohtar>   And I want to assign a javascript variable value to
    ohtar> 'instance' The javascript code is:
  
 
    ohtar>  <script language="JavaScript"> function example(){ var art
    ohtar> art =
    ohtar> document.exampleForm.artistOnChange[document.noadsterForm.artistOnChange.selectedIndex].text
    ohtar> } </script>
 
    ohtar> I call the javascript function in my xsl code when someone
    ohtar> select something in a form:

You are NOT calling the javascript function from your xslt code - you
are using XSLT to GENERATE a call to a javascript function (presumably
you are generating html). This is a very different thing indeed.
  
    ohtar>  <select name="artistOnChange" onchange="example">
 
 
    ohtar>   I want to save the value of the javascript variable 'art'
    ohtar> into the xsl:variable 'instance'. How can I do that?  I'm
    ohtar> using xalan.
  
You can't. XSLT finishes, and you are left with an html page, which
you are then displaying (presumably) in your web browser.
-- 
Colin Paul Adams
Preston Lancashire

Current Thread