Hi
Where my input XML contains "fragment" elements I am generating fo:blocks
with a grey background and black border. Consecutive fragments are coalesced
into what looks like a single block with one outer border (but they need to
be separate fo:blocks so that page breaks occur at a block boundary).
This is working, but I am getting some edge effects. These are apparent as
faint ghostly lines where the block boundaries occur - these must be due to
some sort of rounding/floating arithmetic as they do not appear consistently
at every boundary nor do they appear consistently on all
screens/resolutions.
I presume I am not the first person to see this kind of artefact, but Google
hasn't helped me find a solution. Can anyone here help me? Do I need to
overlay the blocks somehow (and how does one do that anyway)?
Thanks for any hints
Trevor
===
The relevant xsl-fo templates are these:
<xsl:attribute-set name="fragment.base.set">
<xsl:attribute name="font-family">Courier, monospace</xsl:attribute>
<xsl:attribute name="white-space-treatment">preserve</xsl:attribute>
<xsl:attribute name="white-space-collapse">false</xsl:attribute>
<xsl:attribute name="keep-together.within-page">always</xsl:attribute>
<xsl:attribute name="font-size">9pt</xsl:attribute>
<xsl:attribute name="background-color">#e0e0e0</xsl:attribute>
<xsl:attribute name="padding-before">3pt</xsl:attribute>
<xsl:attribute name="padding-after">3pt</xsl:attribute>
<xsl:attribute name="padding-start">6pt</xsl:attribute>
<xsl:attribute name="padding-end">6pt</xsl:attribute>
<xsl:attribute name="margin">0</xsl:attribute>
<xsl:attribute name="border-style">solid</xsl:attribute>
<xsl:attribute name="border-width">0.25mm</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name="fragment.set"
use-attribute-sets="fragment.base.set">
<xsl:attribute name="border-color">black</xsl:attribute>
<xsl:attribute name="space-before.minimum">0.4em</xsl:attribute>
<xsl:attribute name="space-before.optimum">0.5em</xsl:attribute>
<xsl:attribute name="space-before.maximum">0.6em</xsl:attribute>
<xsl:attribute name="space-after.minimum">0.4em</xsl:attribute>
<xsl:attribute name="space-after.optimum">0.5em</xsl:attribute>
<xsl:attribute name="space-after.maximum">0.6em</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name="fragment.top.set"
use-attribute-sets="fragment.base.set">
<xsl:attribute name="border-top-color">black</xsl:attribute>
<xsl:attribute name="border-left-color">black</xsl:attribute>
<xsl:attribute name="border-right-color">black</xsl:attribute>
<xsl:attribute name="border-bottom-color">#e0e0e0</xsl:attribute>
<xsl:attribute name="space-before.minimum">0.4em</xsl:attribute>
<xsl:attribute name="space-before.optimum">0.5em</xsl:attribute>
<xsl:attribute name="space-before.maximum">0.6em</xsl:attribute>
<xsl:attribute name="space-after">0em</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name="fragment.middle.set"
use-attribute-sets="fragment.base.set">
<xsl:attribute name="border-top-color">#e0e0e0</xsl:attribute>
<xsl:attribute name="border-left-color">black</xsl:attribute>
<xsl:attribute name="border-right-color">black</xsl:attribute>
<xsl:attribute name="border-bottom-color">#e0e0e0</xsl:attribute>
<xsl:attribute name="space-before">0em</xsl:attribute>
<xsl:attribute name="space-after">0em</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name="fragment.bottom.set"
use-attribute-sets="fragment.base.set">
<xsl:attribute name="border-top-color">#e0e0e0</xsl:attribute>
<xsl:attribute name="border-left-color">black</xsl:attribute>
<xsl:attribute name="border-right-color">black</xsl:attribute>
<xsl:attribute name="border-bottom-color">black</xsl:attribute>
<xsl:attribute name="space-before">0em</xsl:attribute>
<xsl:attribute name="space-after.minimum">0.4em</xsl:attribute>
<xsl:attribute name="space-after.optimum">0.5em</xsl:attribute>
<xsl:attribute name="space-after.maximum">0.6em</xsl:attribute>
</xsl:attribute-set>
<xsl:template
match="fragment[not(preceding-sibling::*[1][self::fragment])]">
<xsl:apply-templates select="." mode="inlist" />
</xsl:template>
<xsl:template match="fragment" mode="inlist">
<xsl:choose>
<xsl:when test="not(preceding-sibling::*[1][self::fragment])">
<xsl:choose>
<xsl:when test="not(following-sibling::*[1][self::fragment])">
<!-- sole fragment -->
<fo:block xsl:use-attribute-sets="fragment.set" >
<xsl:apply-templates />
</fo:block>
</xsl:when>
<xsl:otherwise>
<!-- first fragment -->
<fo:block xsl:use-attribute-sets="fragment.top.set" >
<xsl:apply-templates />
</fo:block>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="not(following-sibling::*[1][self::fragment])">
<!-- last fragment -->
<fo:block xsl:use-attribute-sets="fragment.bottom.set" >
<xsl:apply-templates />
</fo:block>
</xsl:when>
<xsl:otherwise>
<!-- middle fragment -->
<fo:block xsl:use-attribute-sets="fragment.middle.set" >
<xsl:apply-templates />
</fo:block>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
<xsl:apply-templates select="following-sibling::*[1][self::fragment]"
mode="inlist" />
</xsl:template>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]