[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: [docbook-apps] Table layout in fo output
----- Original Message ----- From: "Danny Kruitbosch" <d.kruitbosch@rdc.nl> To: <docbook-apps@lists.oasis-open.org> Sent: Sunday, December 07, 2003 11:34 PM Subject: [docbook-apps] Table layout in fo output > Hi, > > My documents contain al lot of tables and I'd like have some more > control over the layout. Setting borders and backgound color etc for > each cell becomes a bit tedious...So what I was thinking was the following: > > It would be nice if I could set the layout for the entire table by > setting the 'role' attribute for the <table> element and create a > customization layer to create the style for the table. I've seen the > example in the Docbook XSL guide about row background colors > (http://www.sagehill.net/docbookxsl/BGtableColor.html#d0e27273). But > this only works for html ouput and not for FO output. > > The effect of this should be somewhat like applying a table style in MS > Word. > > Does this work? and if so can someone point me in the right direction? > (I know how to use docbook, but I'm not a XSL guru) Yes, this is possible. You might want to use the tabstyle attribute instead of role since that is what tabstyle is for. The customization will require modification of XSL templates. Most tables are started with the template named "calsTable" in fo/formal.xsl. The fo:table is where you would put properties that apply to the whole table. Then you need to also look in fo/table.xsl, look for the templates with match="row" and match="entry|entrytbl". In those templates, you can use an xsl:choose statement to test whether the ancestor table element has a tabstyle attribute. For example: <xsl:when test="ancestor-or-self::table/@tabstyle = 'style3'" You will be wanting to add or change property attributes on the elements fo:table, fo:table-row, and fo:table-cell. You can do that for individual properties using the xsl:attribute element if it follows the opening fo:something tag. You can also use attribute-sets, which would be easier for maintenance of your styles since you can keep them outside them templates. See fo/param.xsl for examples of attribute-sets. To use an attribute set, you do this: <fo:table-cell xsl:use-attribute-sets="tabstyle3.cell.properties"> The downside of attribute-sets is that the name used cannot be an XSL variable. The means you have to put the fo:table-cell element (start and end tags) in the xsl:when. For an example of that, see the template match="section" in fo/sections.xsl. Hopefully this will get you started. Bob Stayton Sagehill Enterprises bobs@sagehill.net
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]