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 Michael König <Mi...@ms-koenig.de> on 2002/10/25 00:22:51 UTC

table with variable column width

Hello,

in my PDF-Document I have a table. The entries for the first column can have
very different maximum length (between 3cm and 8cm).

I I would like to dynamically set the width for this column. FOPO is not
able to determin the width
automatically, but it would be easy formy to do it applikation side.

Now I have 2 ideas, with you could help with:

1) the I thinkt easier but longish:

I define several table (with variable first column's width)like
<table_3> first column has length 3cm
<table_4>   "      "    "    "    4cm

together with the FOP-table environment

<xsl:template match="table_X">
            <fo:table>
	        <fo:table-column column-width="Xcm"/>
              <fo:table-column column-width="18mm"/>
		  ............

and in the XML-file the PDF is created from uses the one which fits best.

2) the more elegant, with I need you help for
 I calculate the exacte width for the first column and put it in the XML as
a parameter
like

<table_X width="3.5cm">

and read this width in the FOP like

<xsl:template match="table_X">
 <fo:table>
   <fo:table-column column-width="value of the parameter width"/>
   <fo:table-column column-width="18mm"/>
   ............

There is no big deal to put the parameter to tha XML-tag dynamically, but I
have no idea
how the read XML-parameter values in the XSL-Stylesheet for as show above.

Any ideas,

Regards,
Michael



Re: table with variable column width

Posted by "J.Pietschmann" <j3...@yahoo.de>.
Michael König wrote:
>  I calculate the exacte width for the first column and put it in the XML as
> a parameter
> like
> 
> <table_X width="3.5cm">
> 
> and read this width in the FOP like
> 
> <xsl:template match="table_X">
>  <fo:table>
>    <fo:table-column column-width="value of the parameter width"/>
>    <fo:table-column column-width="18mm"/>
>    ............
> 
> There is no big deal to put the parameter to tha XML-tag dynamically, but I
> have no idea
> how the read XML-parameter values in the XSL-Stylesheet for as show above.

Try
  <xsl:template match="table_X">
   <fo:table>
     <fo:table-column column-width="{@width}"/>

That's called attribute value template.
For pure XSLT questions like this, ask on the XSL list:
  http://www.mulberrytech.com/xsl/xsl-list/

J.Pietschmann