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 "Benjohn P. Villedo" <bv...@chpii.com> on 2004/03/12 07:02:01 UTC

FOP commands to XSL

hi all,

Good Day!!!

i am really new to this thus the experimentation. i wanted to create 
tables that are side by side each other like on a page i have 5 tables 
aligned side by side with each other... am really not sure how this is 
done but as far as reading is concerned i came across block-
containers property i was wondering if you could help me convert 
these lines FO to XSL lines

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<fo:block-container border-color="black" border-style="solid" border-
width=".5mm" height="0.5cm" width="8.95
cm" top="3cm" left="0cm" padding=".6mm" position="absolute">
                <fo:block text-align="start" line-height="14pt" font-
family="sans-serif" font-size="12pt">
                    SOLD TO
                </fo:block>
            </fo:block-container>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

i just found those lines in the example/fo/basic/border.fo file which 
clearly works on this url 
http://www.chpii.com:8080/fop?fo=/usr/local/fop/examples/fo/basic/b
order.fo

now since we are getting data from a dynamic source the approach 
was to create an XML file then use the XSL file to translate the XML 
file then further convert it to PDF file

inside the XSL file i tried this but didn't work
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<xsl:template match="block_table">
  <fo:block-container border-color="black"
                      border-style="solid"
                      border-width=".5mm"
                      height="0.5cm"
                      width="8.95cm"
                      top="3cm"
                      left="0cm"
                      padding=".6mm"
                      position="absolute">
    <fo:block text-align="start" 
                   line-height="14pt" 
                   font-family="sans-serif" 
                   font-size="12pt">
      <xsl:apply-templates/>                   
   </fo:block>
  </fo:block-container>
</xsl:template>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


inside the XML file i tried
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<block_table>
this is a test
</block_table>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

but the browser gave me the error
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Failed To Execute Pipeline
org.apache.cocoon.ProcessingException: Failed to execute 
pipeline.: java.lang.RuntimeException: 
java.lang.ClassCastException: org.apache.fop.layout.BlockArea
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

hope you could help me in this endeavor... all the best!!


pal,
benjohn

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


Re: tables question

Posted by "Benjohn P. Villedo" <bv...@chpii.com>.
hi all,

Good Day!!!

thanks for giving me that bright idea i was able to achieve what i 
wanted... hmm... i shouldn't have looked at at block-container in the 
first place it made me all the more confused hehehe :-) here is what 
i did though....

using the existing xsl-fo "table" tag i omitted the <p></p> of the table 
cell in the xml file thus giving me this 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<table>
<tgroup cols="3">
<colspec colname="col1" colwidth="2in"/>
<colspec colname="col2" colwidth="2in"/>
<colspec colname="col3" colwidth="2in"/>
<tbody>
<row>
<entry colnum="1" valign="top"> </entry>
<entry colnum="2" valign="top"> </entry>
<entry colnum="3" valign="top"> </entry>
</row>
</tbody>
</tgroup>
</table>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


then inserted this table inside each column
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<block_table>
<tgroup cols="1">
<colspec colname="col1" colwidth="2in"/>
<tbody>
<row>
<entry colnum="1" valign="top"><p>test</p></entry>
</row>
</tbody>
</tgroup>
</block_table>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


which now looked like this
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<table>
<tgroup cols="3">
<colspec colname="col1" colwidth="2in"/>
<colspec colname="col2" colwidth="2in"/>
<colspec colname="col3" colwidth="2in"/>
<tbody>
<row>
<entry colnum="1" valign="top"> 

<block_table>
<tgroup cols="1">
<colspec colname="col1" colwidth="2in"/>
<tbody>
<row>
<entry colnum="1" valign="top"><p>test row 1</p></entry>
</row>
<row>
<entry colnum="1" valign="top"><p>test row 2</p></entry>
</row>
<row>
<entry colnum="1" valign="top"><p>test row 3</p></entry>
</row>
</tbody>
</tgroup>
</block_table>


</entry>
<entry colnum="2" valign="top"> 

<block_table>
<tgroup cols="1">
<colspec colname="col1" colwidth="2in"/>
<tbody>
<row>
<entry colnum="1" valign="top"><p>test 2</p></entry>
</row>
</tbody>
</tgroup>
</block_table>

</entry>
<entry colnum="3" valign="top"> 

<block_table>
<tgroup cols="1">
<colspec colname="col1" colwidth="2in"/>
<tbody>
<row>
<entry colnum="1" valign="top"><p>test 3</p></entry>
</row>
</tbody>
</tgroup>
</block_table>

</entry>
</row>
</tbody>
</tgroup>
</table>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

this one worked :-) thanks once more for the patience in teaching 
me this technique... all the best!!!

pal,
benjohn



On 15 Mar 2004 at 4:04, J.Pietschmann wrote:

> Benjohn P. Villedo wrote:
> > i came across this property tag 
> > <fo:table absolute-position="absolute" left="1in" top="2in"> 
> > and tried to implement it however the tables still don't get 
> > horizontally aligned with each other
> 
> Absolut positioning isn't implemented for tables.
> Use another blind table and put your for tables in it.
> 
> J.Pietschmann
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: fop-user-help@xml.apache.org




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


Re: tables question

Posted by "J.Pietschmann" <j3...@yahoo.de>.
Benjohn P. Villedo wrote:
> i came across this property tag 
> <fo:table absolute-position="absolute" left="1in" top="2in"> 
> and tried to implement it however the tables still don't get 
> horizontally aligned with each other

Absolut positioning isn't implemented for tables.
Use another blind table and put your for tables in it.

J.Pietschmann

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


RE: tables question

Posted by "Benjohn P. Villedo" <bv...@chpii.com>.
hi there all,

Good Day!!!

i came across this property tag 
<fo:table absolute-position="absolute" left="1in" top="2in"> 
and tried to implement it however the tables still don't get 
horizontally aligned with each other

on the .xsl file
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<xsl:template match="table">
  <fo:table width="2in"
            table-layout="fixed"
            absolute-position="absolute"
            left="1in"
            top="2in">
    <xsl:apply-templates/>
  </fo:table>
</xsl:template>

<xsl:template match="table2">
  <fo:table width="2in"
            table-layout="fixed"
            absolute-position="absolute"
            left="3.5in"
            top="2in">
    <xsl:apply-templates/>
  </fo:table>
</xsl:template>

<xsl:template match="table3">
  <fo:table width="2in"
            table-layout="fixed"
            absolute-position="absolute"
            left="6in"
            top="2in">
    <xsl:apply-templates/>
  </fo:table>
</xsl:template>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


now on the .xml file
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<block_table>
<tgroup cols="1">
<colspec colname="col1" colwidth="2in"/>
<tbody>
<row>
<entry colnum="1" valign="top"><p>test </p></entry>
</row>
</tbody>
</tgroup>
</table>

<block_table2>
<tgroup cols="1">
<colspec colname="col1" colwidth="2in"/>
<tbody>
<row>
<entry colnum="1" valign="top"><p>test 2 </p></entry>
</row>
</tbody>
</tgroup>
</table>

<block_table3>
<tgroup cols="1">
<colspec colname="col1" colwidth="2in"/>
<tbody>
<row>
<entry colnum="1" valign="top"><p>test 3</p></entry>
</row>
</tbody>
</tgroup>
</table>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

however, instead the output becomes horizontally aligned, they turn 
out to become still vertically aligned... hmm i thought i had the 
solution already... hope to hear again from you all thanks... all the 
best!!!

pal,
benjohn

On 13 Mar 2004 at 15:06, Andreas L. Delmelle wrote:

> > -----Original Message-----
> > From: Benjohn P. Villedo [mailto:bvilledo@chpii.com]
> > >
> > > i was wondering if anyone could teach me the easiest way to
> > output 3 to 4 tables that are
> > > horizontally aligned with each other... hmm am so lost in this
> > XSL-FO thingy though i am able to
> > > print tables but they are in vertical alignment.... if possible
> > it would be like
> > >
> > > ______ ______ ______ ______
> > > |table 1| |table 2| |table 3| |table 4|
> > >
> 
> Hi,
> 
> Can you create a phantom table for this with 4 columns? Each of the columns
> contains one of the above specified tables...
> 
> 
> Hope this helps!
> 
> Cheers,
> 
> Andreas
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: fop-user-help@xml.apache.org




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


RE: tables question

Posted by "Andreas L. Delmelle" <a_...@pandora.be>.
> -----Original Message-----
> From: Benjohn P. Villedo [mailto:bvilledo@chpii.com]
> >
> > i was wondering if anyone could teach me the easiest way to
> output 3 to 4 tables that are
> > horizontally aligned with each other... hmm am so lost in this
> XSL-FO thingy though i am able to
> > print tables but they are in vertical alignment.... if possible
> it would be like
> >
> > ______ ______ ______ ______
> > |table 1| |table 2| |table 3| |table 4|
> >

Hi,

Can you create a phantom table for this with 4 columns? Each of the columns
contains one of the above specified tables...


Hope this helps!

Cheers,

Andreas


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


Re: tables question

Posted by "Benjohn P. Villedo" <bv...@chpii.com>.
i forgot to mention the process of conversion its

XML -> XSL <-> FOP -> PDF

thanks in advance...

- same

> hi all,
> 
> Good Day!!!
> 
> i was wondering if anyone could teach me the easiest way to output 3 to 4 tables that are 
> horizontally aligned with each other... hmm am so lost in this XSL-FO thingy though i am able to 
> print tables but they are in vertical alignment.... if possible it would be like
> 
> ______ ______ ______ ______
> |table 1| |table 2| |table 3| |table 4|
> 
> appreciate any help out there... all the best!!!
> 
> pal,
> benjohn




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


tables question

Posted by "Benjohn P. Villedo" <bv...@chpii.com>.
hi all,

Good Day!!!

i was wondering if anyone could teach me the easiest way to output 
3 to 4 tables that are horizontally aligned with each other... hmm am 
so lost in this XSL-FO thingy though i am able to print tables but 
they are in vertical alignment.... if possible it would be like

______  ______ ______  ______
|table 1| |table 2| |table 3| |table 4|

appreciate any help out  there... all the best!!!

pal,
benjohn

Re: FOP commands to XSL

Posted by Chris Bowditch <bo...@hotmail.com>.
Benjohn P. Villedo wrote:

<snip/>

> but the browser gave me the error
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Failed To Execute Pipeline
> org.apache.cocoon.ProcessingException: Failed to execute 
> pipeline.: java.lang.RuntimeException: 
> java.lang.ClassCastException: org.apache.fop.layout.BlockArea
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> hope you could help me in this endeavor... all the best!!

ClassCastException can occur when working when block-containers if the 
block-container is not a direct descendent of the flow element. This is 
simply a limitation of FOP. You will need to change your XSL stylesheet 
to make sure the block-container appears only as a direct descendent of 
the flow element. As Andreas suggested, to help you in this task you may 
need to output the intermediate XSL-FO. See below link on how to do this 
from XML and XSL files:

http://xml.apache.org/fop/running.html#check-input

Chris






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


RE: FOP commands to XSL

Posted by "Andreas L. Delmelle" <a_...@pandora.be>.
> -----Original Message-----
> From: Benjohn P. Villedo [mailto:bvilledo@chpii.com]
>
<snip />
>
> but the browser gave me the error
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Failed To Execute Pipeline
> org.apache.cocoon.ProcessingException: Failed to execute
> pipeline.: java.lang.RuntimeException:
> java.lang.ClassCastException: org.apache.fop.layout.BlockArea
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> hope you could help me in this endeavor... all the best!!
>

At first glance there seems to be nothing intrinsically wrong with your
code...
Can you perform the transformation in a separate step for debugging, and
post us the resulting FO (or a minimized version)?


Cheers,

Andreas


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