You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by adam colin <cj...@yahoo.com> on 2000/11/10 13:34:17 UTC
how can i get javascript to work in XSLT?
I have the following problem, and would appreciate any
help..
I want to make use of the extensions from Xalan-Java
which will allow me to define my own javascript
functions. i can't however get xalan to load the
javascript langauge. I followed the instructions at
the apache site..
I have bsf.jar, bsfengines.jar (binaries from
working-dogs.com) and js.jar(1.5 from mozilla) in my
classpath on tomcat. I have my stylesheet set up as
below..
I get the following error displayed on the tomcat
startup window under NT..
Call to extension function failed: unable to load
language: javascript
Looks like the BSF engine cannot load the js.jar...
here is my stylesheet
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:jjc="http://www.spektra.co.uk"
xmlns:lxslt="http://xml.apache.org/xslt"
xmlns:colin="http://www.spektra.co.uk"
extension-element-prefixes="colin">>
<xsl:template match="/">
<html>
<body>
<xsl:apply-templates select="//test"/>
</body>
</html>
</xsl:template>
<xsl:template match="//test">
<p> we have lift off </p> <xsl:value-of
select="colin:currentDate()"/>
</xsl:template>
<lxslt:component prefix="colin"
functions="currentDate">
<lxslt:script lang="javascript">
function currentDate() {
return "hello"
}
</lxslt:script>
</lxslt:component>
</xsl:stylesheet>
__________________________________________________
Do You Yahoo!?
Thousands of Stores. Millions of Products. All in one Place.
http://shopping.yahoo.com/