<!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.&nbsp; All is going well, I'm able to get a PDF generated and am starting to make formatting changes.&nbsp; One of the changes requires trying to use an embedded Javascript function to do some more complicated checking of the DOM.&nbsp; 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">&quot;The URI <A HREF="http://www.doejs.com/" TARGET="_blank">http://www.doejs.com/</A> does not identify an external Java class&quot;</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">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;</FONT>
<BR><FONT SIZE=2 FACE="Courier New">&lt;xsl:stylesheet xmlns:xsl=&quot;<A HREF="http://www.w3.org/1999/XSL/Transform" TARGET="_blank">http://www.w3.org/1999/XSL/Transform</A>&quot;</FONT>
<BR><FONT SIZE=2 FACE="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; xmlns:fo=&quot;<A HREF="http://www.w3.org/1999/XSL/Format" TARGET="_blank">http://www.w3.org/1999/XSL/Format</A>&quot; </FONT>
<BR><FONT SIZE=2 FACE="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; xmlns:lxslt=&quot;<A HREF="http://xml.apache.org/xslt" TARGET="_blank">http://xml.apache.org/xslt</A>&quot;</FONT>
<BR><FONT SIZE=2 FACE="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; xmlns:doejs=&quot;<A HREF="http://www.doejs.com/" TARGET="_blank">http://www.doejs.com/</A>&quot;</FONT>
<BR><FONT SIZE=2 FACE="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; extension-element-prefixes=&quot;doejs&quot;</FONT>
<BR><FONT SIZE=2 FACE="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; version=&quot;1.0&quot;&gt;</FONT>
</P>

<P><FONT SIZE=2 FACE="Courier New">&lt;lxslt:component prefix=&quot;doejs&quot; functions=&quot;getResult&quot;&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">&lt;lxslt:script lang=&quot;javascript&quot;&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">function getResult() {</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">return '123';</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">}</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">&lt;/lxslt:script&gt;</FONT>
<BR><FONT SIZE=2 FACE="Courier New">&lt;/lxslt:component&gt;</FONT>
</P>
<BR>

<P><FONT SIZE=2 FACE="Courier New">&lt;xsl:template match=&quot;intro-chapter&quot;&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">&lt;fo:block font-size=&quot;20pt&quot;&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">&lt;xsl:value-of select=&quot;doejs:getResult()&quot;/&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">&lt;xsl:value-of select=&quot;456&quot;/&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">&lt;/fo:block&gt;</FONT>
<BR><FONT SIZE=2 FACE="Courier New">&lt;/xsl:template&gt;</FONT>
</P>

<P><FONT SIZE=2 FACE="Courier New">&lt;/xsl:stylesheet&gt;</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.&nbsp; 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 &quot;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;&quot; com.renderx.xep.JAXPDriver -Dcom.renderx.xep.ROOT=&quot;C:\Program Files\XEP&quot; -xml &quot;c:\cgpubsys\guides\test\xml\hmd.xml&quot; -xsl &quot;c:\program files\softquad\xmetal 3\fop\cgstandard01_fo.xsl&quot; -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.&nbsp; 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>