Reputation: 41
<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>      </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:...
Upvotes: 0
Views: 4123
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>      </xsl:text>
</fo:block>
</xsl:when>
Upvotes: 1