xsl-list
[Top] [All Lists]

xalan scripting extension setup

2003-03-04 08:45:46
I have xalan running as part of cocoon on Tomcat and I'd like to setup scripting extensions but am having a difficult time setting up javascript extensions according to the instructions on http://xml.apache.org/xalan-j/extensions.html.

The following style sheet:

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
        xmlns:sql="http://apache.org/cocoon/SQL/2.0";
        xmlns:xalan="http://xml.apache.org/xalan";
        xmlns:my-ext="ext1"
        extension-element-prefixes="my-ext">

<xalan:component prefix="my-ext" functions="dummy">
 <xalan:script lang="javascript">
   function dummy(){
     return "hop to it";
   }
 </xalan:script>
</xalan:component>

<!-- omitted intermediate templates -->

<xsl:template match="sql:categories">
 <stuff>
   <xsl:value-of select="."/>
   <extensions>
<xsl:variable name="today" select="Date:new()" xmlns:Date="xalan://java.util.Date"/>
     <xsl:value-of select="$today"/>
     <function><xsl:value-of select="my-ext:dummy()"/></function>
     </extensions>
 </stuff>
</xsl:template>
</xsl:stylesheet>

returns this result:

<?xml version="1.0" encoding="UTF-8" ?>
<content xmlns:xalan="http://xml.apache.org/xalan"; xmlns:sql="http://apache.org/cocoon/SQL/2.0";>
 <stuff>
   ~15%~1~Male~ ~20%~~Female~ ~11%~~Neither~
   <extensions>
     Tue Mar 04 10:28:59 EST 2003
     <function />
   </extensions>
 </stuff>
</content>

So the javascript extension doesn't work. I placed the bsf.jar and js.jar files in the tomcat/shared/lib folder and figured that would put it in the classpath. Is that wrong?

I-Lin Kuo, Ann Arbor, MI
Macromedia Certified ColdFusion 5.0 Advanced Developer
Sun Certified Java 2 Programmer
Ann Arbor Java Users Group (http://www.aajug.org)



_________________________________________________________________
MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*. http://join.msn.com/?page=features/virus


XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>
  • xalan scripting extension setup, I-Lin Kuo <=