Re: [xsl] Finding a fo:table-cells parent column's width for nested table

Subject: Re: [xsl] Finding a fo:table-cells parent column's width for nested table
From: "JD Daniels" <jd@xxxxxxxxxxxx>
Date: Thu, 6 Mar 2003 23:46:55 -0800
whew. Ok I get the concept I need now :)

Thanks.

JD

----- Original Message -----
From: "J.Pietschmann" <j3322ptm@xxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Thursday, March 06, 2003 4:19 PM
Subject: Re: [xsl] Finding a fo:table-cells parent column's width for nested
table


> JD Daniels wrote:
> > I am a little confused.. What do you mean by default templates?
> There is a built-in template for every element and for text nodes,
> which wont pass parameters. See the FAQ or the XSLT spec for more
> details.
>
> > Say the xsl stylesheet has processed the parent table, and we have
> >
> > column-width=70mm
> > column-width=110mm
> > column-width=70mm
> >
> > now two rows down and one column into this table, I have an another
table.
> > Is there a way to tell that iteration that it only has 110mm to assign
to
> > the newest table width? (ie- pass 110 as blockwidth to
process-col-width)
>
> Umm, I forgot you'll have to pass the column width rather than the
> block width. This is a bit of a challenge, it seems the conceptionally
> easiest way would be to build a variable with an RTF containing the
> column widths
>   <xsl:variable name="columns">
>     <xsl:variable name="top-row-cells"
>       select="counttr[1]/th|tr[1]/td"/>
>     <xsl:variable name="column-count" select="count($top-row-cells)"/>
>     <xsl:for-each select="$top-row-cells">
>       <fo:table-column>
>         <xsl:attribute name="column-width">
>           <xsl:call-template name="process-col-width">
>             <xsl:with-param name="width" select="@width"/>
>             <xsl:with-param name="numcols" select="$column-count)/>
>             <xsl:with-param name="parentblockwidth"
>                 select="$blockwidth"/>
>           </xsl:call-template>
>         </xsl:attribute>
>       </fo:table-column>
>     </xsl:for-each>
>   </xsl:variable>
> Copy this into the table and alos pass this as a node set to the row
> templates. You need a processor specific extension function for this,
> look it up in your processor's docs:
>   <fo:table-body>
>     <xsl:apply-templates>
>       <xsl:with-param name="columns" select="exslt:node-set($columns)"/>
>     </xsl:apply-templates>
>   </fo:table-body>
>
> In the td templates, retrieve the width:
>   <xsl:template match="td">
>     <xsl:param name="columns"/>
>     <xsl:variable name="position" select="position()"/>
>     <xsl:variable name="blockwidth"
>       select="columns[$position]/@column-width"/>
>     ...
>
> Don't forget to pass the necessary parameters through intermediate
> templates.
>
> J.Pietschmann
>
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread