<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2653.12">
<TITLE>Configuring XEP for Embedded JavaScript Functionality</TITLE>
</HEAD>
<BODY>
<P><FONT SIZE=2 FACE="Courier New">Hello,</FONT>
</P>
<P><FONT SIZE=2 FACE="Courier New">I'm a newbie to XEP and (truthfully) to Java, so please bear with me if these are stupid questions...</FONT>
</P>
<P><FONT SIZE=2 FACE="Courier New">I'm using the trial version 3.2.1 and have created a relatively simple XSL-FO stylesheet to processes my XML document. All is going well, I'm able to get a PDF generated and am starting to make formatting changes. One of the changes requires trying to use an embedded Javascript function to do some more complicated checking of the DOM. I've searched for examples on the web where this is done, and I believe I'm doing everything correctly, but I get an error message when I try to build the PDF, I get the following error:</FONT></P>
<P><FONT SIZE=2 FACE="Courier New">"The URI <A HREF="http://www.doejs.com/" TARGET="_blank">http://www.doejs.com/</A> does not identify an external Java class"</FONT>
</P>
<P><FONT SIZE=2 FACE="Courier New">Of course, I just made up this namespace, but the examples I've seen seem to do the same thing -- again, I'm not a Java guy so I may be doing something really obviously wrong.</FONT></P>
<P><FONT SIZE=2 FACE="Courier New">Without sending a whole lot of code, </FONT>
</P>
<P><FONT SIZE=2 FACE="Courier New">Here's a test XSL that demonstrates the error... The error only occurs when I actually try to call the javascript function (if I comment out the call, the PDF is generated fine):</FONT></P>
<P><FONT SIZE=2 FACE="Courier New"><?xml version="1.0" encoding="UTF-8"?></FONT>
<BR><FONT SIZE=2 FACE="Courier New"><xsl:stylesheet xmlns:xsl="<A HREF="http://www.w3.org/1999/XSL/Transform" TARGET="_blank">http://www.w3.org/1999/XSL/Transform</A>"</FONT>
<BR><FONT SIZE=2 FACE="Courier New"> xmlns:fo="<A HREF="http://www.w3.org/1999/XSL/Format" TARGET="_blank">http://www.w3.org/1999/XSL/Format</A>" </FONT>
<BR><FONT SIZE=2 FACE="Courier New"> xmlns:lxslt="<A HREF="http://xml.apache.org/xslt" TARGET="_blank">http://xml.apache.org/xslt</A>"</FONT>
<BR><FONT SIZE=2 FACE="Courier New"> xmlns:doejs="<A HREF="http://www.doejs.com/" TARGET="_blank">http://www.doejs.com/</A>"</FONT>
<BR><FONT SIZE=2 FACE="Courier New"> extension-element-prefixes="doejs"</FONT>
<BR><FONT SIZE=2 FACE="Courier New"> version="1.0"></FONT>
</P>
<P><FONT SIZE=2 FACE="Courier New"><lxslt:component prefix="doejs" functions="getResult"></FONT>
<BR> <FONT SIZE=2 FACE="Courier New"><lxslt:script lang="javascript"></FONT>
<BR> <FONT SIZE=2 FACE="Courier New">function getResult() {</FONT>
<BR> <FONT SIZE=2 FACE="Courier New">return '123';</FONT>
<BR> <FONT SIZE=2 FACE="Courier New">}</FONT>
<BR> <FONT SIZE=2 FACE="Courier New"></lxslt:script></FONT>
<BR><FONT SIZE=2 FACE="Courier New"></lxslt:component></FONT>
</P>
<BR>
<P><FONT SIZE=2 FACE="Courier New"><xsl:template match="intro-chapter"></FONT>
<BR> <FONT SIZE=2 FACE="Courier New"><fo:block font-size="20pt"></FONT>
<BR> <FONT SIZE=2 FACE="Courier New"><xsl:value-of select="doejs:getResult()"/></FONT>
<BR> <FONT SIZE=2 FACE="Courier New"><xsl:value-of select="456"/></FONT>
<BR> <FONT SIZE=2 FACE="Courier New"></fo:block></FONT>
<BR><FONT SIZE=2 FACE="Courier New"></xsl:template></FONT>
</P>
<P><FONT SIZE=2 FACE="Courier New"></xsl:stylesheet></FONT>
</P>
<P><FONT SIZE=2 FACE="Courier New">*************************************</FONT>
</P>
<P><FONT SIZE=2 FACE="Courier New">Also, because I don't know any better, here's the command line I'm using to build the PDF. I've seen reference to making sure the BSF.jar and JS.jar files are in the classpath, but am not sure I've done this correctly.</FONT></P>
<P><FONT SIZE=2 FACE="Courier New">java -classpath "C:\Program Files\XEP\lib\xep321_trial.jar;C:\Program Files\XEP\lib\cryptix32.jar;C:\Program Files\XEP\lib\cryptix32-pgp.jar;C:\Program Files\XEP\lib\saxon.jar;C:\Program Files\XEP\lib\xt.jar;C:\Program Files\XEP\lib\bsf.jar;C:\Program Files\XEP\lib\js.jar;" com.renderx.xep.JAXPDriver -Dcom.renderx.xep.ROOT="C:\Program Files\XEP" -xml "c:\cgpubsys\guides\test\xml\hmd.xml" -xsl "c:\program files\softquad\xmetal 3\fop\cgstandard01_fo.xsl" -out testx.pdf</FONT></P>
<BR>
<P><FONT SIZE=2 FACE="Courier New">Most of the classpath is taken directly out of the transform.bat file, with the paths to BSF and JS tacked on at the end. I realize that if XEP is adopted here, I'll have to become much more versed in Java, but this is just supposed to be a proof-of-concept effort and any help would be greatly appreciated.</FONT></P>
<P><FONT SIZE=2 FACE="Courier New">Regards,</FONT>
<BR><FONT SIZE=2 FACE="Courier New">Todd Powell</FONT>
<BR><FONT SIZE=2 FACE="Courier New">US Dept of Energy</FONT>
</P>
</BODY>
</HTML>