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] 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:
 
http://www.sagehill.net/docbookxsl/CustomMethods.html#CustomizationLayer
 
There is also an example of customizing this template:
 
http://www.sagehill.net/docbookxsl/PrintTableStyles.html#table.cell.properties
 
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>
 
...
 
 
Bob Stayton
Sagehill Enterprises
bobs@sagehill.net
 
 
----- Original Message -----
Sent: Monday, June 04, 2012 1:11 PM
Subject: Re: [docbook-apps] striped table border colors

I realize it has been several months since I broached this subject. As this was a back-burner issue I have only recently revisited this. However, I have not been able to generate the results I had hoped for yet. 

I am trying to customize the fo/table.xsl to address the cell.border.color as is the subject here. 

My first question is that there seem to be two areas that refer to table.cell.properties, I am assuming the one I want is the 2nd one following the <!-- Expand this template to add properties to any fo:table-cell --> comment. 

OK, now from the comment, and some dabbling, should I assume the right approach is to add that structure to my custom layer... or do I want to modify the table.xsl straight away?

The second and biggest problem I am having is that I am not sure what the right 'call' to get the column separators other than black. 
My first attempt as illustrated in my first letter: 
<xsl:attribute name="border-right">0.5pt white</xsl:attribute> <xsl:attribute name="border-left">0.5pt white</xsl:attribute>
did not work, but seems like it might be going down the right road.

I have tried something along these lines:
      <xsl:call-template name="border">
          <xsl:with-param name="table.cell.border.color" select="'white'"/>
        </xsl:call-template>

Not to throw more confusion at this with bad code, than necessary. What would be the correct structure to get the the column rules to turn white? 
I wonder if you might be able to supply some example of the code to do that? 

I hope that is not too much to ask, but it would really help as I have run into a wall here. 

Thank you kindly!

/G. 
-----Original Message-----
From: Bob Stayton <bobs@sagehill.net>
To: docbook-apps <docbook-apps@lists.oasis-open.org>; Gregorio Pevaco <gpevaco@aol.com>
Sent: Thu, Mar 1, 2012 1:55 am
Subject: Re: [docbook-apps] striped table border colors

Hi Gregorio,
Borders within a table are set on table cells, not on rows.  I believe the reason for that must be cell spans, which can put the bottom of a cell in one row in the next row or several rows.
 
Customize the template 'table.cell.properties' from fo/table.xsl to set the custom borders.
 
Bob Stayton
Sagehill Enterprises
bobs@sagehill.net
 
 
----- Original Message -----
Sent: Wednesday, February 29, 2012 2:05 PM
Subject: [docbook-apps] striped table border colors

Hello: 

I have a particular style of table I am attempting to generate into PDF using the fo stylesheets. 
Specifically I am getting custom striped rows, but I also need to generate white rowsep/colsep or cell borders. I am trying to do this in my custom layer, and here is a piece of the xsl:
 

<xsl:template name="table.row.properties">
  <xsl:variable name="tabstyle">
    <xsl:call-template name="tabstyle"/>
  </xsl:variable>
   <xsl:variable name="rownum">
    <xsl:number from="tgroup" count="row"/>
  </xsl:variable>
  <xsl:choose>
    <xsl:when test="$tabstyle = 'striped'">
      <xsl:if test="$rownum mod 2 = 0">
        <xsl:attribute name="background-color">#939598</xsl:attribute>
        <!--attributes to change border colors?-->
<xsl:attribute name="border-right">0.5pt white</xsl:attribute>
        <xsl:attribute name="border-left">0.5pt white</xsl:attribute>
      </xsl:if>
    <xsl:if test="$rownum mod 2 != 0">
      <xsl:attribute name="background-color">#bcbec0</xsl:attribute>
<!--?attributes to change border colors?-->    
    </xsl:if>
   </xsl:when>
 </xsl:choose>
</xsl:template>



Obviously this is not working, the portions following <!--attributes to change border colors?--> are simply variations of my attempts to get some sort of change to the table.cell.properties, 
however I could not find any sort of combination to get the result I wish for, which would be white colored rules between the cells of the table. 

Is this even possible? Any suggestions?

Thank you for taking the time to read my questions.
/Gregorio


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