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] Table Column text formatting.


> > Hi,
> >
> > Is there a way to specify that a column is being used as a title type
>
> column
>
> > without having to individually specify it each entry for that column?
> >
> > e.g.
> >
> > Code    Name      Description
> > A       Active    The Active Code
> > I       Inactive  The Inactive Code
> >
> > I want everything in the "Code" Column above to have the text formatted
> > differently (generally bold) to the normal text formatting.
> >
> > Output is for both xhtml and PDF, using Saxon, FOP, and the XSL 1.62.4
> > stylesheets, and I *think* following the CALS specs for tables.
>
> Cals tables don't have a way to indicate row headers, which is what you
> are looking for.  You have to do it cell by cell.

Ok. Have fiddled around with the stylesheets and found a way to do this for 
both fo and html/xhtml using the @role attribute on the tbody element (since 
this generally applies to stuff in the table body). It's probably a kludge, 
but it works, so instead of putting the stuff in the role attribute for 2 
entry elements on each of 100 rows, you only need to put it in once.

For the fo:
Copy the full <xsl:template match="entry|entrytbl" name="entry"> template from 
fo/table.xsl into your customisation layer. Scroll down the template until 
you find the lines:

      <fo:table-cell xsl:use-attribute-sets="table.cell.padding">
        <xsl:if test="$xep.extensions != 0">
           <!-- some stuff -->
        </xsl:if>

add in directly under the </xsl:if> line

<xsl:if test="(ancestor::tbody/@role = 'colheading1' and $entry.colnum= '1')">
   <xsl:attribute name="font-weight">bold</xsl:attribute>
</xsl:if>

This checks to see whether the tbody element has the attribute 
role="colheading1", and if so if the entry column number is 1 applied bold to 
the entry. It can be modified to whatever text formatting you prefer to use, 
and additional columns added by adding more stuff to the test, eg:

test="(ancestor::tbody/@role = 'colheading1' and $entry.colnum = '1') 
        or (ancestor::tbody/@role = 'colheading2' and ($entry.colnum = '1' or 
$entry.colnum = '2'))">

would apply the formatting to either column one for colheading1 or both column 
one and two for colheading2.



For the html/xhtml:
Copy the full <xsl:template match="entry|entrytbl" name="entry"> template from 
html/table.xsl or xhtml/table.xsl into your customisation layer. Scroll down 
the template until you find the lines:

      <xsl:element name="{$cellgi}" namespace="http://www.w3.org/1999/xhtml";>
        <xsl:if test="$bgcolor != ''">
           <!-- some stuff -->
        </xsl:if>

add in directly under the </xsl:if> line

<xsl:if test="(ancestor::tbody/@role = 'colheading1' and $entry.colnum='1')">
   <xsl:attribute name="class">heading</xsl:attribute>
</xsl:if>

In a .css file, create a rule for formatting td[class="heading"] as needed.

Like the fo example, the test can be customised to include other combinations 
of which columns to format as a heading.

Cheers,
Janeene.



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