You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Dennis Thrysoe - Netnord A/S <dt...@netnord.dk> on 2001/12/22 21:53:55 UTC
Embedding FOP
Hi,
Is there an easy way of embedding FOP, including a stylesheet
transformation?
Using the Driver class doesn't seem to allow this (or did I miss
something?).
If I use Xalan to generate results to the ContentHandler, that the
Driver instance returns, I get an error:
Unknown formatting object http://www.w3.org/XSL/Format/1.0^root
Do I need a DOCTYPE or something here?
It would be really great if FOP could take care of the transformation
before rendering - just as with the -XSL commandline argument.
Any help appreciated!
-dennis
Re: Embedding FOP
Posted by Dennis Thrysoe - Netnord A/S <dt...@netnord.dk>.
I've now gotten a bit further. I start Xalan transforming some XML into
a SAXResult object constructed with the FOP Driver's Content Handler.
This gave me a NullPointerException, because the Driver only sets the
StreamRenderer on the FOTreeBuilder when calling one of the two render()
methods. (Which is not necesarry when using the ContentHandler instead.)
Therefore I used the following hack to make things work:
StreamRenderer streamRenderer = new StreamRenderer(new
FileOutputStream("c:\\baz.pdf"), driver.getRenderer());
((FOTreeBuilder)handler).setStreamRenderer(streamRenderer);
But I still get a NullPointerException. I cannot, however, see where it
is thrown, as Xalan eats all original exceptions.
If serialize the excact same series of SAX events into a file and run
FOP as a command-line program on this file - everything works dandy.
So what this boils down to is: I can get FOP to process the XML as long
as it comes from an XMLReader (Xerces), but it won't process the excact
same XML when it comes from Xalan.
I suspect that the problem could be namespace-related. But what can I do
differently with the Driver/FOTreeBuilder?
-dennis
Dennis Thrysoe - Netnord A/S wrote:
> Keiron Liddle wrote:
>
>> On 2001.12.22 21:53 Dennis Thrysoe - Netnord A/S wrote:
>>
>>> Hi,
>>>
>>> Is there an easy way of embedding FOP, including a stylesheet
>>> transformation?
>>>
>>> Using the Driver class doesn't seem to allow this (or did I miss
>>> something?).
>>>
>>> If I use Xalan to generate results to the ContentHandler, that the
>>> Driver instance returns, I get an error:
>>>
>>> Unknown formatting object http://www.w3.org/XSL/Format/1.0^root
>>
>>
>>
>> You have the wrong namespace, it should be:
>> http://www.w3.org/1999/XSL/Format
>
>
> That's what I originally tried, but then I got (the same):
>
> building formatting object tree
> setting up fonts
> WARNING: Unknown formatting object http://www.w3.org/1999/XSL/Format^root
>
>
> Any help still very much appreciated...
>
> -dennis
Re: Embedding FOP
Posted by Dennis Thrysoe - Netnord A/S <dt...@netnord.dk>.
Keiron Liddle wrote:
> On 2001.12.22 21:53 Dennis Thrysoe - Netnord A/S wrote:
>
>> Hi,
>>
>> Is there an easy way of embedding FOP, including a stylesheet
>> transformation?
>>
>> Using the Driver class doesn't seem to allow this (or did I miss
>> something?).
>>
>> If I use Xalan to generate results to the ContentHandler, that the
>> Driver instance returns, I get an error:
>>
>> Unknown formatting object http://www.w3.org/XSL/Format/1.0^root
>
>
> You have the wrong namespace, it should be:
> http://www.w3.org/1999/XSL/Format
That's what I originally tried, but then I got (the same):
building formatting object tree
setting up fonts
WARNING: Unknown formatting object http://www.w3.org/1999/XSL/Format^root
Any help still very much appreciated...
-dennis
Re: Embedding FOP
Posted by Keiron Liddle <ke...@aftexsw.com>.
On 2001.12.22 21:53 Dennis Thrysoe - Netnord A/S wrote:
> Hi,
>
> Is there an easy way of embedding FOP, including a stylesheet
> transformation?
>
> Using the Driver class doesn't seem to allow this (or did I miss
> something?).
>
> If I use Xalan to generate results to the ContentHandler, that the
> Driver instance returns, I get an error:
>
> Unknown formatting object http://www.w3.org/XSL/Format/1.0^root
You have the wrong namespace, it should be:
http://www.w3.org/1999/XSL/Format