W3C home > Mailing lists > Public > www-xsl-fo@w3.org > November 2008

Re: Table style templates

From: dahepe <peger@gmx.net>
Date: Fri, 14 Nov 2008 01:00:17 -0800 (PST)
Message-ID: <20496932.post@talk.nabble.com>
To: www-xsl-fo@w3.org


Thanks for your replies!!

Both the named template and the attribute-set suggestion helped a lot.

I think I'll stay with the attribute sets as it seems more intuitive for me.
That is only the formatting stuff (padding, font, alignment, etc.) is
referenced and the actual structure (table cells and rows) remains.

For the curious looking for an example for how to use an attribute set (I
had a little problem with this, too) here is what my table heading
declaration now looks like:
...
<fo:table-header background-color="lightgray">
  <fo:table-row>
    <fo:table-cell xsl:use-attribute-sets="header-cell-attrs">
      <fo:block>Documentname</fo:block>
    </fo:table-cell>
    <fo:table-cell xsl:use-attribute-sets="header-cell-attrs">
      <fo:block>Version</fo:block>
    </fo:table-cell>
    <fo:table-cell xsl:use-attribute-sets="header-cell-attrs">
      <fo:block>Format</fo:block>
    </fo:table-cell>
    <fo:table-cell xsl:use-attribute-sets="header-cell-attrs">
      <fo:block>Status</fo:block>
    </fo:table-cell>
    <fo:table-cell xsl:use-attribute-sets="header-cell-attrs">
      <fo:block>Sector</fo:block>
    </fo:table-cell>
  </fo:table-row>
</fo:table-header>
...

<xsl:attribute-set name="header-cell-attrs">
  <xsl:attribute name="border-style">solid</xsl:attribute>
  <xsl:attribute name="font-weight">bold</xsl:attribute>
  <xsl:attribute name="padding">2pt</xsl:attribute>
</xsl:attribute-set>
...

Thanks a lot,
Daniel.


Jeremias Maerki-2 wrote:
> 
> 
> In addition to that, the xsl:attribute-set and xsl:use-attribute-sets
> pair (both XSLT features) served me well in the past. I often create a
> separate "styles" stylesheet with only attribute sets which I then
> import in the other stylesheets to separate large parts of the FO
> styling from the actual transformation logic.
> 
> On 13.11.2008 10:49:14 David Carlisle wrote:
>> 
>> 
>> The model for XSL FO is that (more or less) everything is expanded out
>> in the FO file, but the program that you use to create that file
>> (usually XSLT) can of course use the features of that language to
>> organise the generation.
>> 
>> here for example it looks like you could use a named template, something
>> like 
>> 
>> <xsl:template name="cell">
>>   <xsl:param name="body"/>
>>       <fo:table-cell padding-before="1pt" padding-after="1pt"
>> padding-start="2pt" padding-end="2pt"
>>         border-style="solid">
>>       <fo:block><xsl:value-of select="$body/></fo:block>
>>     </fo:table-cell>
>> </xsl:template>
>> 
>> Then
>> 
>> <xsl:call-template>
>>   <xsl:param name="body" select="format"/>
>> </xsl:call-template>
>> <xsl:call-template>
>>   <xsl:param name="body" select="sector"/>
>> </xsl:call-template>
>> 
>> David
> 
> 
> 
> HTH,
> Jeremias Märki
> _________________________________________________________
> Jeremias Märki, Software-Development and Consulting
> Contact Information: http://www.jeremias-maerki.ch/contact.html
> Blog: http://www.jeremias-maerki.ch/blog/
> 
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Table-style-templates-tp20476932p20496932.html
Sent from the w3.org - www-xsl-fo mailing list archive at Nabble.com.
Received on Friday, 14 November 2008 09:00:53 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 14 November 2008 09:00:54 GMT