I'm not sure if this is a javascript problem per se, but here goes. I have an xsl document with a python function defined within a <script> block. Elsewhere in the xsl file, within a python script block, I call the python function and store the return value in a variable. I need to be able to display this returned value on the webpage that the xsl generates. I tried to do a document.write([python returned variable]) but found that document.write() causes firefox to hang when used within an xsl file. So instead I used document.getElementById().innerHTML to display the python returned value. This works in ie7 but in firefox the output is blank. So the problem is that internet explorer is letting me pass a variable that was given a value from a python function return value and firefox is not letting me jumble the types as such.
Heres a very simplified version of the problem:
[HTML]<html>
<span id="out">This text will be replaced</span>
<script language="Python" type="text/python">
import sample
text = sample.get_string()
document.getElementById("out").innerHTML = text
</script>
</html>
[/HTML]
import sample, imports a file called sample.py which is located in the same directory. It is just:
Expand|Select|Wrap|Line Numbers
- #sample.py
- def get_string():
- return "ABCD"
I'm really stuck here and the only other option I can think of is to rewrite the python function in javascript but this would be my last resort as the real python function is pretty complex.
Is there any way to pass the python variable to the javascript function call?
Thanks in advance