Hi all,

I am working on Xalan-J XSLT processor.I have implemented the javascript extension function but in runtime it is showing TransformerException. Please help me on this.

I am using jdk1.6 and included xalan.jar,xercesImpl.jar,xml-apis.jar;serializer.jar;bsf.jar;js.jar;xsltc.jar into my classpath.

Hereby, I am attaching the code what I have written

<?xml version="1.0"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xalan="http://xml.apache.org/xalan"
xmlns:exslt="http://exslt.org/common"
xmlns:my-javascript-ext="http://xml.apache.org/xalan/xsltc/java"
extension-element-prefixes="my-javascript-ext"
version="1.0">
<xsl:output method="text"/>
<xalan:component prefix="my-javascript-ext"
elements="" functions="hello">
<xalan:script lang="javascript">


function hello() {
return ("Hello " + "world" + "!");
}
</xalan:script>
</xalan:component>
<!--
Test of JavaScript functions,
they are working fine in Xalan Process! -->
<xsl:template match="/">
<xsl:if test="function-available('my-javascript-ext:hello')">
<xsl:value-of select="'Entered into If'"></xsl:value-of>
</xsl:if>


<xsl:value-of select="my-javascript-ext:hello"/>
</xsl:template>
</xsl:stylesheet>

Hi,
With bsf 2.3.0.jar use rhino15R3.zip file.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.