[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] XSL-FO - border straying where it is not wanted


Subject: [xsl] XSL-FO - border straying where it is not wanted
From: "Trevor Nicholls" <trevor@xxxxxxxxxxxxxxxxxx>
Date: Thu, 19 Mar 2009 02:32:55 +1300

Hi

I am formatting high-level titles with an "overline" for emphasis, using
border-top.

The stylesheet is XSL 2.0 processed by Saxon.

My problem is that where my input has a very long title, the border wraps
with the title and the border above the second line cuts through the first
line of the title. I would like to truncate the border at the margin in this
situation, but I probably need to use a different technique to achieve that.

I can insert an appropriately coloured and dimensioned line which extends
from one side of the text area to the other by detaching it from the title
block and preceding it, but then the line appears at the full width even for
shorter titles, which is not the requirement.

This is a simplified version of the templates which match such a title:

 <xsl:attribute-set name="headline.set">
    <xsl:attribute name="font-family">Arial,sans-serif</xsl:attribute>
    <xsl:attribute name="font-weight">bold</xsl:attribute>
    <xsl:attribute name="keep-with-next.within-page">always</xsl:attribute>
 </xsl:attribute-set>

 <xsl:attribute-set name="title.set" use-attribute-sets="headline.set">
    <xsl:attribute name="start-indent">-1.5cm</xsl:attribute>
    <xsl:attribute name="space-before">2em</xsl:attribute>
    <xsl:attribute name="space-after">0.5em</xsl:attribute>
 </xsl:attribute-set>

 <xsl:template match="title">
    <fo:block font-size="150%" xsl:use-attribute-sets="title.set">
        <fo:inline>
            <xsl:attribute name="border-top-color">gray</xsl:attribute>
            <xsl:attribute name="border-top-style">double</xsl:attribute>
            <xsl:attribute name="border-top-width">1.25mm</xsl:attribute>
            <xsl:attribute name="padding-top">2mm</xsl:attribute>
            <xsl:apply-templates />
        </fo:inline>
    </fo:block>
 </xsl:template>

 <xsl:template match="text()">
	<xsl:value-of select="." />
 </xsl:template>

I would appreciate a few pointers in the right direction if someone can
spare me a little advice. (Almost) anything is possible, right?

Thank you very much
Trevor


Current Thread
Keywords
xsl