At 02:31 PM 7/12/01 +0100, Gareth Noyce wrote:
[ SNIP ]
>I'll leave out the Java class for brevity, it's basically the same as the
>3-java-namespace example from Xalan.
>
>The Java class is on the classpath, I included a function 'main' to test
>this and all works fine. The XML, XSL and Java will all process through
>Xalan as expected, and an XSL:FO file is produced correctly, no problems.
>However, I wish to use FOP to do all this in one go with the usual
>"java -jar fop.jar -xml g-test.xml -xsl g-test.xsl -pdf out.pdf" -- and this
>is where my problem crops up. When I run the command as shown, the error:
>
><filepath>; Line 123; Column 87; ERROR: BchDate
>
>is shown.
>
>I understand this error to be along the lines of a "Can't find class
>BchDate", as I had the same problem with Xalan whilst learning how to
>implement extensions.

I think you're right, as far as the semantics of the ERROR message is 
concerned. One reason you can't find a class is because you didn't compile 
the source; are you sure you have the _classfile_ available that corresponds 
to your BchDate class?

Reason I ask that is, this burned me, too, for about an hour. I never 
thought to compile the extension class. When I did, everything worked (i.e. 
having FOP do everything all at once as with your command line above).

My final example is very close to yours. Here is the stylesheet root:

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
xmlns:fo="http://www.w3.org/1999/XSL/Format";
xmlns:bchext="xalan://util.BchDate"
xmlns:java="http://xml.apache.org/xslt/java";
exclude-result-prefixes="java">

and here are 2 segments of the stylesheet that shows use of the functions:

<xsl:variable name="format" select="string('EEE MMM dd yyyy')"/>

<xsl:variable name="year" select="'2001'"/>
<xsl:variable name="month" select="'07'"/>
<xsl:variable name="day" select="'18'"/>

...

<fo:block border-right-width="0.5pt" text-align="center"
vertical-align="middle" border-style="solid" line-height="11pt">
        <xsl:variable name="formatter"
select="java:java.text.SimpleDateFormat.new($format)"/>
<!--   <xsl:variable name="formatdate"
select="bchext:getDate($year,$month,$day)"/> -->
        <xsl:variable name="formatdate"
select="java:util.BchDate.getDate($year,$month,$day)"/>
        <xsl:value-of select="java:format($formatter,$formatdate)"/>
</fo:block>

My BchDate.java is identical to the Xalan IntDate.java.

I commented out the call to getDate() that uses the class format 
declaration; that also works just fine.

Regards,
Arved Sandstrom

Fairly Senior Software Type
e-plicity (http://www.e-plicity.com)
Wireless * B2B * J2EE * XML --- Halifax, Nova Scotia


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to