Najlaa Stitou
Najlaa Stitou

Reputation: 41

using "fo inline" and keep together within line make the text go out of the box and never go to the next line

<xsl:for-each select="../div">
  <xsl:choose>
    <xsl:when test="@class='champLibre'">
      <fo:inline keep-with-next.within-line="always" >
        <xsl:value-of select="text()"/>
      </fo:inline> 
      <fo:inline  border-bottom-style="dotted"  border-bottom-color="#000"
            border-bottom-width="1pt"><xsl:value-of select="div/text()"/>
          <xsl:text>&#160;&#160;&#160;&#160;&#160;&#160;</xsl:text>
      </fo:inline> 
    </xsl:when>

I want to align the block (the content of the div + some text) in the same line, so that when it comes to the end of line the block which contains div+some text must go to the next line if there is no enough space for both div + some text.

However, I get something like this:

First line:  .... some 
Second line: words:.....

What I want is:

First line:  .... 
Second line: some words:...

without using keep

after using keep together within line

Upvotes: 0

Views: 4123

Answers (1)

Tony Graham
Tony Graham

Reputation: 8068

The fo:inline (currently) has to be kept with what comes next in the line, and what comes next is an fo:inline that ends with a non-breaking space. You haven't left anywhere for the line to break.

Try putting each pair into a separate fo:block:

<xsl:for-each select="../div">
  <xsl:choose>
    <xsl:when test="@class='champLibre'">
      <fo:block>
        <xsl:value-of select="text()"/>
        <fo:inline  border-bottom-style="dotted"  border-bottom-color="#000"
            border-bottom-width="1pt">
          <xsl:value-of select="div/text()"/>
          <xsl:text>&#160;&#160;&#160;&#160;&#160;&#160;</xsl:text>
      </fo:block> 
    </xsl:when>

Upvotes: 1

Related Questions