Re: [xep-support] Configuring XEP for Embedded JavaScript Functionality

From: Alexander Peshkov (peshkov@renderx.com)
Date: Fri Feb 28 2003 - 00:54:19 PST

  • Next message: Bernd Kuemmerlen: "[xep-support] Catalog support in saxon"

    Hello Todd,

    Actually it's not an XSL FO or XEP question. You try to use some XSLT
    extension which seems to be unsupported by SAXON, the XSLT processor
    we use. I suppose you have some other XSLT engine; if it has a JAXP
    interface, you can plug it in instead of SAXON by adding the
    appropriate jar to CLASSPATH instead of (or before) saxon.jar. You may
    also need to set "javax.xml.transform.TransformerFactory" system
    property to point to a specific class in your XSLT engine.

    Best regards,
    Alexander Peshkov mailto:peshkov@renderx.com
    RenderX

    PT> Hello,

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

    PT> I'm using the trial version 3.2.1 and have created a relatively simple
    PT> XSL-FO stylesheet to processes my XML document. All is going well, I'm able
    PT> to get a PDF generated and am starting to make formatting changes. One of
    PT> the changes requires trying to use an embedded Javascript function to do
    PT> some more complicated checking of the DOM. I've searched for examples on
    PT> the web where this is done, and I believe I'm doing everything correctly,
    PT> but I get an error message when I try to build the PDF, I get the following
    PT> error:

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

    PT> Of course, I just made up this namespace, but the examples I've seen seem to
    PT> do the same thing -- again, I'm not a Java guy so I may be doing something
    PT> really obviously wrong.

    PT> Without sending a whole lot of code,

    PT> Here's a test XSL that demonstrates the error... The error only occurs when
    PT> I actually try to call the javascript function (if I comment out the call,
    PT> the PDF is generated fine):

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

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

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

    PT> </xsl:stylesheet>

    PT> *************************************

    PT> Also, because I don't know any better, here's the command line I'm using to
    PT> build the PDF. I've seen reference to making sure the BSF.jar and JS.jar
    PT> files are in the classpath, but am not sure I've done this correctly.

    PT> java -classpath "C:\Program Files\XEP\lib\xep321_trial.jar;C:\Program
    PT> Files\XEP\lib\cryptix32.jar;C:\Program
    PT> Files\XEP\lib\cryptix32-pgp.jar;C:\Program
    PT> Files\XEP\lib\saxon.jar;C:\Program Files\XEP\lib\xt.jar;C:\Program
    PT> Files\XEP\lib\bsf.jar;C:\Program Files\XEP\lib\js.jar;"
    PT> com.renderx.xep.JAXPDriver -Dcom.renderx.xep.ROOT="C:\Program Files\XEP"
    PT> -xml "c:\cgpubsys\guides\test\xml\hmd.xml" -xsl "c:\program
    PT> files\softquad\xmetal 3\fop\cgstandard01_fo.xsl" -out testx.pdf

    PT> Most of the classpath is taken directly out of the transform.bat file, with
    PT> the paths to BSF and JS tacked on at the end. I realize that if XEP is
    PT> adopted here, I'll have to become much more versed in Java, but this is just
    PT> supposed to be a proof-of-concept effort and any help would be greatly
    PT> appreciated.

    PT> Regards,
    PT> Todd Powell
    PT> 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 : Fri Feb 28 2003 - 00:40:38 PST