You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Robin Green <gr...@hotmail.com> on 2000/11/10 15:34:49 UTC

Fwd: Re: fop support in cocoon1 fixed?

>From: "Robin Green" <gr...@hotmail.com>
>Reply-To: cocoon-users@xml.apache.org
>To: cocoon-users@xml.apache.org
>Subject: Re: fop support in cocoon1 fixed?
>Date: Fri, 10 Nov 2000 14:24:09 GMT
>
>>Alexander Weinmann wrote:
>> >
>> > I think that the real problem is inside the Xalan version
>> > that comes with Cocoon. Xalan uses DOM Level 1 (no namespaces)
>> > and fop0.14 relies on the dom nodes created with DOM Level2.
>> > This means that I do not see how to get XSLT+FOP working
>> > with Cocoon1.8 and FOP 0.14.
>
>Can I have some more details on that please Alex? E.g. references, URLs,
>mailing list posts. I might try hacking together a DOM1 to DOM2 conversion
>routine, since Cocoon1.8 and Xerces support DOM2.
>
>Anyone else know anything about this?

Oh yeah, also, could someone post a good sample for testing purposes, since 
I'm clueless about FO(P).



_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

Share information about yourself, create your own public profile at 
http://profiles.msn.com.


Re: Fwd: Re: fop support in cocoon1 fixed?

Posted by Alexander Weinmann <aw...@bct-technology.com>.
Below are the two patches that helped me to get the 
FO2PDFFormatter work with Cocoon 1.8. However, there is
at least one problem remaining: FOP cannot handle the
result dom tree of xalan. I think that it is a problem
with namespaces and DOM Level2. In DOM Level2, if you
create Elements with "createElement()", instead of "createElementNS()",
then your namespace is null. FOP 0.14 seems to rely on Namespaces -> Problem.




To make the FO2PDFFormatter work, I did two patches:

The first is for org.apache.formatter.FO2PDFFormatter:

--- FO2PDFFormatter.java        Fri Nov 10 16:05:47 2000
+++ FO2PDFFormatter.java.patched        Fri Nov 10 16:06:25 2000
@@ -79,8 +79,8 @@
            driver.setRenderer("org.apache.fop.render.pdf.PDFRenderer", Version.getVersion());
            driver.addElementMapping("org.apache.fop.fo.StandardElementMapping");
            driver.addElementMapping("org.apache.fop.svg.SVGElementMapping");
-           //driver.addPropertyList("org.apache.fop.fo.StandardPropertyListMapping");
-           //driver.addPropertyList("org.apache.fop.svg.SVGPropertyListMapping");
+           driver.addPropertyList("org.apache.fop.fo.StandardPropertyListMapping");
+           driver.addPropertyList("org.apache.fop.svg.SVGPropertyListMapping");
            driver.setWriter(new PrintWriter(writer));
            driver.buildFOTree(document);
            driver.format();      



The second is for org.apache.fop.apps.Driver:

--- Driver.java Fri Nov 10 16:00:04 2000
+++ Driver.java.patched Fri Nov 10 16:13:06 2000
@@ -317,13 +317,13 @@
                    for (int i = map.getLength() - 1; i >= 0; i--) {
                        Attr att = (Attr)map.item(i);
                        currentAtts.addAttribute("",
+                         att.getLocalName(),
                          att.getName(),
-                         "",
                          "CDATA",
                          att.getValue());
                    }
-                   this.treeBuilder.startElement(
-                       "", currentNode.getNodeName(), "", currentAtts);
+                   this.treeBuilder.startElement (
+                      currentNode.getNamespaceURI(), currentNode.getLocalName(),currentNode.getNodeName() , currentAtts);
                    break;
                }      


Robin Green wrote:
> 
> >From: "Robin Green" <gr...@hotmail.com>
> >Reply-To: cocoon-users@xml.apache.org
> >To: cocoon-users@xml.apache.org
> >Subject: Re: fop support in cocoon1 fixed?
> >Date: Fri, 10 Nov 2000 14:24:09 GMT
> >
> >>Alexander Weinmann wrote:
> >> >
> >> > I think that the real problem is inside the Xalan version
> >> > that comes with Cocoon. Xalan uses DOM Level 1 (no namespaces)
> >> > and fop0.14 relies on the dom nodes created with DOM Level2.
> >> > This means that I do not see how to get XSLT+FOP working
> >> > with Cocoon1.8 and FOP 0.14.
> >
> >Can I have some more details on that please Alex? E.g. references, URLs,
> >mailing list posts. I might try hacking together a DOM1 to DOM2 conversion
> >routine, since Cocoon1.8 and Xerces support DOM2.
> >
> >Anyone else know anything about this?
> 
> Oh yeah, also, could someone post a good sample for testing purposes, since
> I'm clueless about FO(P).
> 
> _________________________________________________________________________
> Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
> 
> Share information about yourself, create your own public profile at
> http://profiles.msn.com.

-- 
Alexander Weinmann | Web Developer
BCT Technology AG | D-77731 Willstätt/Germany | www.bct-technology.com

Re: Fwd: Re: fop support in cocoon1 fixed?

Posted by Alexander Weinmann <aw...@bct-technology.com>.
Below are the two patches that helped me to get the 
FO2PDFFormatter work with Cocoon 1.8. However, there is
at least one problem remaining: FOP cannot handle the
result dom tree of xalan. I think that it is a problem
with namespaces and DOM Level2. In DOM Level2, if you
create Elements with "createElement()", instead of "createElementNS()",
then your namespace is null. FOP 0.14 seems to rely on Namespaces -> Problem.




To make the FO2PDFFormatter work, I did two patches:

The first is for org.apache.formatter.FO2PDFFormatter:

--- FO2PDFFormatter.java        Fri Nov 10 16:05:47 2000
+++ FO2PDFFormatter.java.patched        Fri Nov 10 16:06:25 2000
@@ -79,8 +79,8 @@
            driver.setRenderer("org.apache.fop.render.pdf.PDFRenderer", Version.getVersion());
            driver.addElementMapping("org.apache.fop.fo.StandardElementMapping");
            driver.addElementMapping("org.apache.fop.svg.SVGElementMapping");
-           //driver.addPropertyList("org.apache.fop.fo.StandardPropertyListMapping");
-           //driver.addPropertyList("org.apache.fop.svg.SVGPropertyListMapping");
+           driver.addPropertyList("org.apache.fop.fo.StandardPropertyListMapping");
+           driver.addPropertyList("org.apache.fop.svg.SVGPropertyListMapping");
            driver.setWriter(new PrintWriter(writer));
            driver.buildFOTree(document);
            driver.format();      



The second is for org.apache.fop.apps.Driver:

--- Driver.java Fri Nov 10 16:00:04 2000
+++ Driver.java.patched Fri Nov 10 16:13:06 2000
@@ -317,13 +317,13 @@
                    for (int i = map.getLength() - 1; i >= 0; i--) {
                        Attr att = (Attr)map.item(i);
                        currentAtts.addAttribute("",
+                         att.getLocalName(),
                          att.getName(),
-                         "",
                          "CDATA",
                          att.getValue());
                    }
-                   this.treeBuilder.startElement(
-                       "", currentNode.getNodeName(), "", currentAtts);
+                   this.treeBuilder.startElement (
+                      currentNode.getNamespaceURI(), currentNode.getLocalName(),currentNode.getNodeName() , currentAtts);
                    break;
                }      


Robin Green wrote:
> 
> >From: "Robin Green" <gr...@hotmail.com>
> >Reply-To: cocoon-users@xml.apache.org
> >To: cocoon-users@xml.apache.org
> >Subject: Re: fop support in cocoon1 fixed?
> >Date: Fri, 10 Nov 2000 14:24:09 GMT
> >
> >>Alexander Weinmann wrote:
> >> >
> >> > I think that the real problem is inside the Xalan version
> >> > that comes with Cocoon. Xalan uses DOM Level 1 (no namespaces)
> >> > and fop0.14 relies on the dom nodes created with DOM Level2.
> >> > This means that I do not see how to get XSLT+FOP working
> >> > with Cocoon1.8 and FOP 0.14.
> >
> >Can I have some more details on that please Alex? E.g. references, URLs,
> >mailing list posts. I might try hacking together a DOM1 to DOM2 conversion
> >routine, since Cocoon1.8 and Xerces support DOM2.
> >
> >Anyone else know anything about this?
> 
> Oh yeah, also, could someone post a good sample for testing purposes, since
> I'm clueless about FO(P).
> 
> _________________________________________________________________________
> Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
> 
> Share information about yourself, create your own public profile at
> http://profiles.msn.com.

-- 
Alexander Weinmann | Web Developer
BCT Technology AG | D-77731 Willstätt/Germany | www.bct-technology.com