OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Re: [docbook-apps] Set different margins for each column of a CALS table


Hi Dave,
I'm not completely clear on what effect you are going for, but I can point you in the right direction. As described in Table 30.2 in:

http://www.sagehill.net/docbookxsl/PrintTableStyles.html

there is a utility template named 'table.cell.properties' that is called for each table cell to set attributes on that fo:table-cell, and another one called 'table.cell.block.properties' that is called for each cell to set properties on the fo:block containing the cell's content.

That section also describes how you can get the column number of the current cell with:

<xsl:variable name="cellnumber">
  <xsl:number count="entry" from="row"/>
</xsl:variable>

Note: if you use column spans, this simple counting method will not always yield the right result.

Bob Stayton
Sagehill Enterprises
bobs@sagehill.net


----- Original Message ----- From: redlettucemail
To: docbook-apps@lists.oasis-open.org
Sent: Saturday, October 01, 2011 11:38 PM
Subject: [docbook-apps] Set different margins for each column of a CALS table


I have a table with numbers in each cell that vary in length from one to seven digits (e.g. 1 to 1000000). I’d like to align all ‘entry’ elements *in each respective column* by somehow specifying a variable in which I can set different ‘margin-right’ values so that all ‘entry’ in each column get that particular margin-right value.

I have looked only at the colspec element for each column (thinking that any values specified in that are propagated to ‘entry’ elements) and seeing whether I can specify in the XML code an attribute that would take a % value for margin-right – I can’t see how that’s possible. I’ve also tried specifying a variable in <xsl:template match="d:entry|d:entrytbl" name="entry"> that sets the margin-right value, but I can’t see the logic of how the values could be propagated to each column or where to put the following code:
         <xsl:variable name="numbermargin">
         <xsl:if test="ancestor::d:colspec/@colnum=2">
           <xsl:attribute name="margin-right"> 20% </xsl:attribute>
         </xsl:if>
         <xsl:if test="ancestor::d:colspec/@colnum=3">
           <xsl:attribute name="margin-right"> 25% </xsl:attribute>
         </xsl:if>
         <xsl:if test="ancestor::d:colspec/@colnum=4">
           <xsl:attribute name="margin-right"> 30% </xsl:attribute>
         </xsl:if>
         <xsl:if test="ancestor::d:colspec/@colnum=5">
           <xsl:attribute name="margin-right"> 15% </xsl:attribute>
         </xsl:if>
         </xsl:variable>
I’m not even sure if it’s possible to match up entries with a respective colnum (given my limited knowledge of XPath expressions). Is there a quick solution?

Dave Gardiner

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]