I followed Jay Bryant's advice and structured my xsl file according to
his example.  I got it to work well, but in saving things I overwrote
what I had done.  I recreated it -- almost.  I now have a few questions;

Glad it worked for you as far as it did.

I have attached the xsl and xml tags.  They generate what I am now
asking about. Viewing the output at 100%:

1 - How do I fill the backgrounds of the cells of the third line (the
last header line).

Put the background-color attribute on the table-cell element rather than on the block element.

2 - How can I get the borders top join?  Look at the line between the
last header line and the first business unit header line.  Also, between
the other lines. the intent here is for the borders to be with 1pt of .5pt.

Borders are amazingly tricksy beasts. First off, to really get them to render correctly, you need to throw out the idea of border-collapse. Then you have two choices: Control each border (left, right, top, bottom) for each cell individually or set them all to the same values (width, color, and style). Thus, a simple way to get all the borders in a table to be 1pt wide is to set both the table's border and each cell's border to be .5pt wide. They'll all be adjacent when rendered, and you'll get 1pt borders. If you want something more complicated (some cells have borders while others don't or all the outside borders are double while the inners are solid), you should set each border (left, right, etc.) individually.

To that end, I've moved all your border attributes to table-cells, so that table and block no longer have border attributes.

3 - Why doesn't the border show when cells are empty in the data area?

Actually, it did (I zoomed in to 400% to be sure. However, because the block in the cell had no content, the height of the block was 0, so you had a top border and a bottom border and nothing in between them. Consequently, the block rendered such that it looked like a thick line.

To fix this (and other issues), I removed the borders from blocks and put them on the cells. As a rule of thumb, define borders at the cell level and not at the block level. You should generally only put a border on a block if it's a stand-alone block (not in a table). There are exceptions, but, until you've strengthened your XSL-FO muscle some more, I suggest keeping things simple.

4 - Why does it look like the vertical borders on the last line extend
beyond the bottom of the line?


I'm not seeing that, but I've seen it in other documents. If it's what I think it is, it's a rendering error in Acrobat Reader. Try zooming to different levels and seeing if the problem persists. If it does, you've got work to do. If not, it's a well-known (and much-loathed) quirk of Acrobat Reader.

It just occurred to me that you may mean "Why does the border stick out to the left and right relative to the cells that don't have borders. That's the nature of borders. The cell has its space, and the border has a space around the cell's space. So, if one cell has no border and the next cell down does have a border, the bordered cell appears to "stick out". Take a peek at http://www.w3.org/TR/2001/REC-xsl-20011015/slice4.html#area-intro to see what's happening. To fix those issues, either be consistent about your borders (everything has a border or everything doesn't), use just top and bottom borders, or set the border color of "borderless" cells to the cell's background color.

Also, fo:table doesn't have a line-height attribute, so I put that on the blocks.

I have attached the modified XSLT file.

I am off to a movie, so I can't show you exactly how to control the borders individually right now. I hope these changes help you, though.

Jay Bryant

<?xml version="1.0"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; 
                              xmlns:fo="http://www.w3.org/1999/XSL/Format";>
                              
<xsl:template match="print-compliance">
  <xsl:processing-instruction name="cocoon-format">type="text/xslfo"
  </xsl:processing-instruction>
  <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format";>
    <fo:layout-master-set>
      <fo:simple-page-master master-name="compliance-form"
         margin-top="50pt"
         margin-bottom="50pt"
         margin-left="15pt"
         margin-right="20pt"
         page-height="8.5in"   
         page-width="11in">
        <fo:region-body margin-bottom="1pt"/>
      </fo:simple-page-master>
    </fo:layout-master-set>
    <fo:page-sequence master-reference="compliance-form">
      <fo:flow flow-name="xsl-region-body">
        <xsl:apply-templates select="header" />
        <xsl:apply-templates select="business_units" />
      </fo:flow>
    </fo:page-sequence>
  </fo:root>
</xsl:template>

<xsl:template match="header">
  <fo:table table-layout="fixed" space-before="0pt" border-style="none">
    <xsl:variable name="product_list" select="product_list" />
    <fo:table-column column-width="{fullwidth}"/>
    <fo:table-body >
      <fo:table-row>
        <fo:table-cell background-color="{title_bg_color}" border="{border}">
          <fo:block text-align="center" wrap-option="no-wrap" font-size="{fontsize}" 
          			line-height="{linespace}" font-weight="{fontweight}" 
                color="{color}">
            <xsl:value-of select="report_name"/>
          </fo:block>
        </fo:table-cell>
      </fo:table-row>
    </fo:table-body>
  </fo:table>
  <xsl:apply-templates select="headerline"/>
</xsl:template>

<xsl:template match="headerline">
  <fo:table table-layout="fixed" space-before="0pt">
    <xsl:for-each select="colsize">
      <fo:table-column column-width="{value}"/>
    </xsl:for-each>
    <fo:table-body>
      <fo:table-row line-height="{linespace}"  display-align="{vertical}">
        <xsl:apply-templates select="hdr_itm"/>
      </fo:table-row>
    </fo:table-body>
  </fo:table>
</xsl:template>

<xsl:template match="hdr_itm">
  <fo:table-cell wrap-option="{../wrap}" background-color="{bg_color}"  border="{border}">
    <fo:block text-align="{align}" font-size="{fontsize}" font-weight="{../fontweight}" color="{color}">
      <xsl:value-of select="value"/>
    </fo:block>
  </fo:table-cell>
</xsl:template>

<xsl:template match="business_units">
  <xsl:for-each select="bu">
  	<xsl:apply-templates select="bus_header"/>
  	<xsl:apply-templates select="bus_data"/>
  	<xsl:apply-templates select="bus_summary"/>
  </xsl:for-each>
</xsl:template>        

<xsl:template match="bus_header">
  <fo:table table-layout="fixed" space-before="0pt" space-after="0pt">
    <fo:table-column column-width='{fullwidth}'/>
    <fo:table-body >
      <fo:table-row>
        <fo:table-cell background-color="{bu_bg_color}" border="{border}">
          <fo:block text-align="start" wrap-option="{wrap}" font-size="{fontsize}" 
              line-height="{linespace}" font-weight="bold" color='{bu_color}'>
            <xsl:value-of select="bu_title"/>
          </fo:block>
        </fo:table-cell>
      </fo:table-row>
    </fo:table-body>
  </fo:table>
</xsl:template>

<xsl:template match="bus_data">
  <fo:table table-layout="fixed" space-before="0pt" space-after="0pt">
    <xsl:for-each select="bu_col_width">
      <fo:table-column column-width="{value}"/>
    </xsl:for-each>
    <fo:table-body>
      <xsl:for-each select="bu_line">
        <fo:table-row>
          <xsl:for-each select="bu_item">
            <fo:table-cell border="{borderline}">
              <fo:block text-align="{align}" wrap-option="no-wrap" font-size="{fontsize}" 
                  font-weight="{fontweight}" color="{color}" line-height="{../linespace}">
                <xsl:value-of select="value"/>  
              </fo:block>  	
            </fo:table-cell>
          </xsl:for-each>
        </fo:table-row>
      </xsl:for-each>
    </fo:table-body>
  </fo:table>
</xsl:template>

<xsl:template match="bus_summary">
  <fo:table table-layout="fixed" space-before="0pt" space-after="0pt">
    <xsl:for-each select="sum_col_width">
      <fo:table-column column-width="{value}"/>
    </xsl:for-each>
    <fo:table-body >
      <fo:table-row>
        <xsl:for-each select="summary_item">
          <fo:table-cell background-color='{../bu_bg_color}' border="solid {borderline}">
            <fo:block text-align="{align}" wrap-option="no-wrap" font-size="{fontsize}" 
                font-weight="{fontweight}" color="{color}" line-height="{linespace}">
              <xsl:value-of select="value"/>  
            </fo:block>  	
          </fo:table-cell>
        </xsl:for-each>
      </fo:table-row>
    </fo:table-body>
  </fo:table>        
</xsl:template>

</xsl:stylesheet>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to