W3C home > Mailing lists > Public > www-xsl-fo@w3.org > August 2002

Re: Line break between image and text

From: Hugues Pichereau <hpi-pub@tentelemed.com>
Date: Fri, 09 Aug 2002 11:53:30 +0200
Message-ID: <3D53911A.4C074869@tentelemed.com>
To: www-xsl-fo@w3.org

Tried, doesn't work. Here's the code :

<xsl:for-each select="radiobutton">
    <fo:inline keep-together="always">
        <xsl:apply-templates select="."/>
        <xsl:apply-templates select="label"/>
    </fo:inline>
</xsl:for-each>

<xsl:template match="radiobutton">
    <xsl:variable name="radiobutton-checked"   select="concat($path-images,
'/', 'radiobutton_checked.gif')"/>
    <xsl:variable name="radiobutton-unchecked" select="concat($path-images,
'/', 'radiobutton_unchecked.gif')"/>
    <xsl:if test="@selected='true'">
        <fo:external-graphic keep-with-next="always"
src="{$radiobutton-checked}" width="12pt" height="12pt"/>
    </xsl:if>
    <xsl:if test="@selected='false'">
        <fo:external-graphic keep-with-next="always"
src="{$radiobutton-unchecked}" width="12pt" height="12pt"/>
    </xsl:if>
</xsl:template>

<xsl:template match="label">
    <xsl:if test="../../@layout-orientation='vertical'">
        <fo:block font-size="10pt">
            <xsl:value-of select="."/>
        </fo:block>
    </xsl:if>
    <xsl:if test="../../@layout-orientation='horizontal'">
        <fo:inline  keep-with-previous="always" font-size="10pt">
            <xsl:value-of select="."/>
        </fo:inline>
    </xsl:if>
</xsl:template>


"G. Ken Holman" wrote:

> At 2002-08-08 16:45 +0200, Hugues Pichereau wrote:
> >Does anybody know how to prevent an external-graphic and its following
> >text from breaking to line ?
>
> Use keep-with-next= on the graphic or keep-with-previous= on the text, or
> keep-together= on the pair.
>
> The following illustrates this to me on Antenna House (your margins may
> vary, play with the length of the XX prefix to cause the first one to break
> the line between the graphic and the subsequent text:
>
>    <block>XXXXX: This is a test with a graphic followed by text
> <external-graphic src="url('smflags.bmp')"/><inline>hello
> world</inline></block>
>    <block>XXXXX: This is a test with a graphic followed by text
> <external-graphic src="url('smflags.bmp')"
> keep-with-next="always"/><inline>hello world</inline></block>
>    <block>XXXXX: This is a test with a graphic followed by text
> <external-graphic src="url('smflags.bmp')"/><inline
> keep-with-previous="always">hello world</inline></block>
>    <block>XXXXX: This is a test with a graphic followed by text <inline
> keep-together="always"><external-graphic src="url('smflags.bmp')"/>hello
> world</inline></block>
>
> I hope this helps.
>
> ............... Ken
>
> --
> Upcoming hands-on in-depth 3-days XSLT/XPath and/or 2-days XSL-FO:
> -                               North America:  Sep 30-Oct  4,2002
> -                               Japan:          Oct  7-Oct 11,2002
>
> G. Ken Holman                 mailto:gkholman@CraneSoftwrights.com
> Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/f/
> Box 266, Kars, Ontario CANADA K0A-2E0  +1(613)489-0999 (Fax:-0995)
> ISBN 0-13-065196-6                       Definitive XSLT and XPath
> ISBN 1-894049-08-X   Practical Transformation Using XSLT and XPath
> ISBN 1-894049-07-1                Practical Formatting Using XSLFO
> XSL/XML/DSSSL/SGML/OmniMark services, books (electronic, printed),
> articles, training (instructor-live,Internet-live,web/CD,licensed)
> Next public training:           2002-08-05,26,27,09-30,10-03,07,10
Received on Friday, 9 August 2002 05:54:07 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 3 October 2007 16:06:09 GMT