[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: [docbook-apps] striped table border colors
Hi Gregorio,
Border properties for each side can be
specified with three individual properties, or with a shortcut property that
combines them. For example, these three properties:
<xsl:attribute
name="border-right-width">0.5pt</xsl:attribute>
<xsl:attribute
name="border-right-style">solid</xsl:attribute>
<xsl:attribute
name="border-right-color">white</xsl:attribute>
are equivalent to this shortcut:
<xsl:attribute name="border-right">0.5pt solid
white</xsl:attribute>
with the three values specified in this order, as defined by the
standard. Your example only specified two property values, so it did not
work.
Another shortcut applies the properties to all sides if that is what you
want:
<xsl:attribute name="border">0.5pt solid
white</xsl:attribute> The DocBook template named 'border' is in
fo/table.xsl and is just a convenience for generating the three separate
properties from the stylesheet parameters that set the default border
properties. If you want non-default border properties, then you cannot use
the template named "border". Also, in general a template will not accept
being passed a param for which it does not have a param declaration. The
"border" template only has a param declared for "side", so trying to pass the
color would not work as there is nothing to receive it in the
template.
In table processing, each cell generally takes care
of its own right-side and bottom-side borders only. The top border is
instead handled by the cell above or the table frame if it is the first cell in
a column. Likewise, the left border is handled by the cell to the left or the
table frame if it is the first cell in a row. That avoids conflicts
between neighboring cells, and follows the way CALS tables specify borders as
rowsep (bottom) and colsep (right).
The DocBook XSL template named
'table.cell.properties' is called for each cell in the table, with the context
node being the "entry" element of a CALS table or a "td" element of an
HTML-markup table. That template should be
copied from fo/table.xsl to your customization layer and modified there.
If you aren't familiar with "customization layer", see:
There is also an example of customizing this
template:
In your case, you want to set the column separator
to white, so something like the following could be added to your customization
of the template named 'table.cell.properties'. It first sets a variable to
count rows, and then decides the border attribute with an xsl:choose statement
to alternate white and black column borders.
<xsl:template name="table.cell.properties">
<xsl:param name="bgcolor.pi" select="''"/> <xsl:param name="rowsep.inherit" select="1"/> <xsl:param name="colsep.inherit" select="1"/> <xsl:param name="col" select="1"/> <xsl:param name="valign.inherit" select="''"/> <xsl:param name="align.inherit" select="''"/> <xsl:param name="char.inherit" select="''"/> <variable name="rownumber">
<xsl:number count="row" from="tbody"/>
</xsl:variable>
<xsl:choose>
<xsl:when test="$rownumber mod 2"> <xsl:attribute
name="border-right">0.5pt solid white</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute
name="border-right">0.5pt solid black</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
...
|
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]