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] Alternate background-color in table columns.


Hi,

Peter, Bob, thank you for help.

I managed to do it on table.cell.properties template. I was doing on the wrong templates (table.row.properties and table.cell.block.properties).

Once again, thanks for your help, it was really useful. 

Best Regards,
Rogério Rosa

On Feb 25, 2014, at 6:31 PM, Bob Stayton <bobs@sagehill.net> wrote:

> Hi,
> Indeed, the template for table entry is a monster template.  But it contains a hook that lets you apply formatting properties without needing to copy and modify that big template.  The hook is a call to the template named 'table.cell.properties'.  That template can be customized to insert properties such as background color.  This section in my book describes it in more detail:
> 
> http://www.sagehill.net/docbookxsl/PrintTableStyles.html#table.cell.properties
> 
> If you copy that template to your customization layer, you can use the template param named "col", whose value will be set to 1 for the first column cells.
> 
> If you only want this for some tables, then you can add a tabstyle attribute to the table element, such as tabstyle="firstcolumn".  Then you can use this in the 'table.cell.properties' template as follows:
> 
>  <!-- add this variable declaration -->
>  <xsl:variable name="tabstyle">
>    <xsl:call-template name="tabstyle"/>
>  </xsl:variable>
> 
>  <xsl:choose>
>    <xsl:when test="ancestor::tgroup">
>      <!-- add the following three lines -->
>      <xsl:if test="$tabstyle = 'firstcolumn' and $col = 1">
>          <xsl:attribute name="background-color">#BBBBBB</xsl:attribute>
>      </xsl:if>
>      ...
> 
> Let me know if you need more details.
> 
> Bob Stayton
> Sagehill Enterprises
> bobs@sagehill.net
> 
> On 2/25/2014 9:22 AM, Peter Desjardins wrote:
>> I see here (http://www.sagehill.net/docbookxsl/BGtableColor.html) that
>> you could apply a "dbfo bgcolor" processing instruction to each entry
>> element in your XML source. That doesn't sound very pleasant though.
>> 
>> I would start by trying to customize the XSLT that writes FO elements
>> for tables. The way you do this depends on the specific DocBook
>> elements you are using for tables. If you use d:entry elements, it
>> looks like the <xsl:template match="d:entry|d:entrytbl" name="entry">
>> template in fo/tables.xsl might be a good place to experiment.
>> 
>> It looks like a fairly intricate template and it already does some
>> calculations based on columns. There are probably several ways to
>> identify the first entry in each row. When you figure out a way to do
>> that, try altering the bgcolor variable value.
>> 
>> I hope that's a little helpful.
>> 
>> Peter
>> 
>> On Tue, Feb 25, 2014 at 11:00 AM, Rogério Rosa
>> <rogerio.rosa@eixodigital.com> wrote:
>>> Hey,
>>> 
>>> I am trying to generate a PDF.
>>> 
>>> Rogério
>>> 
>>> On Feb 25, 2014, at 3:59 PM, Peter Desjardins <peter.desjardins.us@gmail.com> wrote:
>>> 
>>>> What format is your output? HTML, PDF, something else?
>>>> 
>>>> Peter
>>>> 
>>>> On Tue, Feb 25, 2014 at 10:19 AM, Rogério Rosa
>>>> <rogerio.rosa@eixodigital.com> wrote:
>>>>> Hello,
>>>>> 
>>>>> I am trying to set a different background colour for the first column in a table, however I am not managing to do it. There is anyone that can help me ?
>>>>> 
>>>>> Thanks in advance.
>>>>> Rogério
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
>>>>> For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org
>>>>> 
>>>> 
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
>>>> For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org
>>>> 
>>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
>> For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org
>> 
>> 
>> 
>> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
> For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org
> 



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