docbook-apps

setting a particular table's column widths with xsl

  • 1.  setting a particular table's column widths with xsl

    Posted 04-08-2011 18:35
    Hi again all,
    I've got a particular type of table that I want to set column widths
    on via xsl rather than having to do it in the xml source.

    The reason is that I have _lots_ of xml files that will use this type of
    table and I don't want to have to maintain this if/when we change the
    table layout.

    The html is easy with the css.
    I'm having a problem with the pdf/ps output.

    I don't want to have to use 'colwidth' like this:
    <informaltable tabstyle='encoding'>
    <tgroup cols='4' align='left'>
    <colspec colname='c1' colwidth="1.0*"/>
    <colspec colname='c2' colwidth="3.0*"/>
    <colspec colname='c3' colwidth="2.0*"/>
    <colspec colname='c4' colwidth="3.0*"/>

    <row>
    ...

    I want to be able to just do:
    <informaltable tabstyle='encoding'>
    <tgroup cols='4' align='left'>
    <colspec colname='c1'/>
    <colspec colname='c2'/>
    <colspec colname='c3'/>
    <colspec colname='c4'/>


    <trow>
    ...


    I cant' figure out how to do this.
    I've seen examples on using the table.layout template and such but I'm
    not having any luck.

    IE:
    <xsl:template name="table.layout">
    <xsl:param name="table.content"/>
    <fo:table width="100%" table-layout="fixed" column-width="1.0">
    <fo:table-column column-width="proportional-column-width(1.0)"/>
    <fo:table-column/>
    <fo:table-column column-width="proportional-column-width(1.0)"/>
    <fo:table-column/>
    ...


    Can someone point me in the right direction?
    thanks,
    marcoz