[xep-support] Configuring XEP for Embedded JavaScript Functionality

From: Powell, Todd (Todd.Powell@hq.doe.gov)
Date: Wed Feb 26 2003 - 12:31:03 PST

  • Next message: Nikolai Grigoriev: "Re: [xep-support] Another question?"

    Hello,

    I'm a newbie to XEP and (truthfully) to Java, so please bear with me if
    these are stupid questions...

    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:

    "The URI http://www.doejs.com/ does not identify an external Java class"

    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.

    Without sending a whole lot of code,

    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):

    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                     xmlns:fo="http://www.w3.org/1999/XSL/Format"
                     xmlns:lxslt="http://xml.apache.org/xslt"
                     xmlns:doejs="http://www.doejs.com/"
                     extension-element-prefixes="doejs"
                      version="1.0">

    <lxslt:component prefix="doejs" functions="getResult">
            <lxslt:script lang="javascript">
                    function getResult() {
                            return '123';
                    }
            </lxslt:script>
    </lxslt:component>

    <xsl:template match="intro-chapter">
            <fo:block font-size="20pt">
                    <xsl:value-of select="doejs:getResult()"/>
                    <xsl:value-of select="456"/>
            </fo:block>
    </xsl:template>

    </xsl:stylesheet>

    *************************************

    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.

    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

    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.

    Regards,
    Todd Powell
    US Dept of Energy

    -------------------
    (*) To unsubscribe, send a message with words 'unsubscribe xep-support'
    in the body of the message to majordomo@renderx.com from the address
    you are subscribed from.
    (*) By using the Service, you expressly agree to these Terms of Service http://www.renderx.com/tos.html



    This archive was generated by hypermail 2.1.5 : Wed Feb 26 2003 - 12:29:35 PST