Hi all,

Firstly, many thanks for the hard work on FOP -- it's a great piece of work.

Unfortunately I've stumbled upon a problem which I'm at a loss to figure
out. I'm hoping that someone on the list will be able to shed some light on
the problem.

I've been playing with Java Extension functions under Xalan with great
success. I need to move one of these over to go through FOP in order to
process dates, so I've slightly amended the example as provided with Xalan
to better suit my needs.

I've got a small test xml file which contains the following:


[g-test.xml]
--
<?xml version="1.0"?>
<gtest>
<date>2001-07-11</date>
</gtest>
--

The XSL file generates a FO file suitable for processing by FOP. Cutting out
most of the cruft, the file is as follows:


[g-test.xsl]
--
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
xmlns:fo="http://www.w3.org/1999/XSL/Format";
xmlns:java="http://xml.apache.org/xslt/java"; xmlns:bchext="xalan://BchDate">


 <xsl:template match="/">

    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format";>

      <!-- Layout the page dimensions. A4 landscape... -->

        [SNIP]

      <!-- Start the page sequence... Each page will follow this
odel...  -->

        [SNIP]

    </fo:root>
 </xsl:template>

<xsl:template match="date">

  <!-- This is the format mask for SimpleDateFormat -->
  <xsl:variable name="format" select="string('EEE MMM dd yyyy')"/>

  <xsl:variable name="date" select="string(.)"/>


<fo:table font-size="7pt">
        [TABLE COLUMN SETUP / SNIP]

        <fo:table-header>
        [SNIP]
        </fo:table-header>

        <fo:table-body>
          <fo:table-row>
            <fo:table-cell>
              <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="java:BchDate.getDate($date)"/>
                <xsl:value-of select="java:format($formatter,
$formatdate)"/>
              </fo:block>
            </fo:table-cell>

                ...
                [SNIP]
                ...

          </fo:table-row>
        </fo:table-body>
      </fo:table>
</xsl:template>
</xsl:stylesheet>

--

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.

Can anyone point out what stupid mistake I am making here? I'm at a loss as
to why the same files will process with Xalan-j_2_2_D6 and yet not with
FOP-0.19 which, as I understand it, uses Xalan for the XSLT stage... I've
double checked the CLASS_PATH settings, tested the Java and been all over
the website trying to figure out if I should be using a different namespace
setting for FOP (things aren't particularly clear, there or in the docs).

I'm running NT4 for development, and the server is 2k. Java is JDK1.3.1 from
Sun.

I'm sorry for the length of the post. I thought it would save time to
explain things as verbosly as possible!

Thanks in advance for your time, & best regards

Gareth Noyce

P.S. I'll happily send all my test files to anyone off list if it helps.


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

Reply via email to