Another thing I tried to pass a variable to a JS function -- it gives the
following exception:SEVERE: XPathException in invokeTransform: Exception in
ixsl:call() (RangeError)
If I pass a string it works, but if I pass the variable it does not.
Again, I'm sure I'm doing something stupid.B
Here's the transform:
B B B <xsl:variable name="simple">
B B B B B B simple
B B B </xsl:variable>
B
B B B <xsl:template name="callFunc" >
B B B B B B <xsl:value-of select="js:myFunc($simple)"/>
B B B </xsl:template>
B B B
B B B <xsl:template match="/">
B B B B B B <xsl:call-template name="callFunc" />
B B B </xsl:template>
=========================
If you have the results in an XSLT variable, then I think you should be able
to pass this to Javascript code as an argument of an ixsl:call(), or you could
write it as a property of a Javascript object using ixsl:set-property.
Incidentally, we're quite close now to shipping a first version of Saxon-JS,
which will be a replacement for Saxon-CE written in pure Javascript. The
interfaces between XSLT and JS will probably be quite similar.
Michael KaySaxonica
|