You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by on 2002/10/28 11:04:47 UTC

Fopping 1-12 to Jan-Dec

All I wanted to do was convert a month number 1-12 to month name.

I have the Beginning XSLT Wrox book, and Kay's XSLT 2nd Ed.

I'm enthused about learning this stuff, and yet there
are some major turnoffs being encountered.

Generating documents with FOP is what I'm trying to
do. I know TeX, so the XSL:FO is not too strange.
I have the ORA book for XSL:FO.

I've received an XLST-FO source to maintain, and when I
saw the enumerated if-test sequence to choose a month
name from 1-12, I thought, "There's got to be a shorter
way."

Page 95 of Kay's book:

    <xsl:variable name="months">
        <January/><February/><March/><April/><May/><June/><July/>
        <August/><September/><October/><November/><December/>
    </xsl:variable>

    <xsl:value-of select="name($months/*[position()=2])" />

I've hard-coded February in this example.
Result: [ERROR] No flow found for region-body in page-master 'first'

The code is in the header part of the document-code, in a
'<fo:static-content...>'. But I tried in a non-static flow,
and tried a template version. Nogo.

<Polemic>

I'd like to say how utterly disgusted I am at the error messages
coming out of my XSLT (FOP) compiles/transformations.

Kay's book erroneously shows that last line above as:

    <xsl:value-of select="name($months/*[position()=$mm" />

FYI, his Wrox book's errata page is 404.

When I have the erroneous line in the source, I get over 800
lines of error messages.

What, did a 12-yo kid write XSLT-FOP?

For bleep's sake get a hold of a professional compiler writer
and put in the necessary structures for "normal" error msgs.

Can you imagine the outcry if GNU's gcc did the same thing
when one line of code had a syntax error?

Apparently I have to type in a few lines of code and see if
it compiles before entering more code, because otherwise there's
no way to figure out what's wrong! As in, 'The error messages
are so bad I have to resort to commenting out code just to have
a freakin' clue as to where I went wrong.'

What kind of way to develop is that?

Yes, I recognize this as Java-style "throwing an exception", or
in this case, "FOPException()." Not an excuse.

No, I am not volunteering my time, and I can't code Java.

Recently I came up to speed on perl, compiled 8.0 on my
Sun SPARC Solaris 8 boxen, and found perl even has a
verbose error message mode that will give you a paragraph
or two on what the error msg (always for a given line#)
might be about and how to fix. Sometimes FOP doesn't even
cough up a line number.

FOP's non-existent implementation of error reporting is
wasting a lot of programmer time and no doubt retards its use.

It should be a top priority for upgrading.

</Polemic>

A newbie hunting and pecking through books and Google results...

I tried xmlns:date="http://exslt.org/dates-and-times", but
that URL is 404. (I emailed Tennison, and also Wrox about
their 404.)

So, FOP doesn't have EXSLT functions?

I downloaded date.zip from exslt.org and added it to the
stylesheet declaration, and an 'xsl:import'.

Now it says it can't find a string padding function.

Hunt...okay, downloaded and unzipped the 'str.zip' deal.

Updated the source...damn, same error.

Apparently the 'date' routines are referring to the 'str' routines
underneath the 'date' subdir 'functions.'

Okay, I tar the 'str' functions directory to overlay the 'date' one.

Nogo. Gave up this approach.


Hmmm, the web pages say the newest 'xalan' has EXSLT built-in.
Can I load its jars into the FOP lib directory and get them?

http://xml.apache.org/fop/relnotes.html
FOP 0.20.4    
    *  FOP should now work with any JAXP1.1 compliant parser/transformer.
       It has been successfully tested with Xerces/Xalan, Saxon and JDK1.4
       (which includes Crimson and Xalan).
    *  The following JARs have been updated: Xerces to version 2.0.1,
       Xalan to version 2.3.1 and Batik to version 1.5beta2.

Maybe? 

Downloading 'xalan-j_2_4_0-bin.tar.gz' from http://xml.apache.org/xalan-j/index.html.

Gunzip, no problem. But the untar... 

x xalan-j_2_4_0/docs/apidocs/org/apache/xalan/transformer/class-use/TransformerImpl.html, 55055 bytes, 108 tape blocks 
tar: directory checksum error

Just fabulous.

I successfully do the zip version, backup FOP/lib, delete x*, move in xalan's jars....

    [ERROR] null 

Tweak...tweak...

    java.lang.NullPointerException

I'm stuck. Have I mentioned:

    All I wanted to do was convert a month number 1-12 to month name.

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org