Re: [xsl] FO: padding within list problem (really FOP)

Subject: Re: [xsl] FO: padding within list problem (really FOP)
From: "J.Pietschmann" <j3322ptm@xxxxxxxx>
Date: Tue, 10 Aug 2004 21:44:23 +0200
Ralph Holz wrote:
I've got the following code snippet:
<fo:list-item>
  <fo:list-item-label>
     <fo:block  padding-bottom="1.7mm">
      <xsl:value-of ...
    </fo:block>
...
The padding properties were added in fo:block because FOP didn't use it when it was within any of the parent elements. (If anyone knows a better solution to this, please let me know.)
Padding (and most other block properties) isn't properly implemented
except for blocks.

They are meant to ascertain a certain distance between the list items. (is that the way to do it?)
Using padding for this is ... not the way padding was intended to
be used.
Try space-after. Use nested blocks if really necessary.

The problem I'm facing is that if anyone of the <xsl:value-of> evaluates to null (i.e. empty element in XML source tree), there is no padding anymore in that line and the next item data overwrites that line (it "moves up").
Well, apparently padding has more than a problem even for blocks.
One way to work around problems with empty blocks is to use a
white-on-white character or perhaps a NBSP (wont work in all contexts),
for example
  <xsl:variable name="my-content" value="... expression ..."/>
  <xsl:choose>
    <xsl:when test="$my-content">
      <!-- perhaps test="normalize-space($my-content)" -->
      <xsl:value-of select="$my-content"/>
    </xsl:when>
    <xsl:otherwise>
      <fo:wrapper color="$bg-color">i</fo:wrapper>
      <!-- or simply <xsl:text>&#160;</xsl:text>
    </xsl:otherwise>
  </xsl:choose>

J.Pietschmann

Current Thread