Context
I am creating an XSL-FO document to convert my XML text to PDF.
In the XSL-FO, I have two consecutive inline elements, I would like a white space between them:
<fo:block>
<xsl:number/> <xsl:value-of select="@title"/>
</fo:block>
The expected result would be:
1 Introduction
Instead, I get
1Introduction
It seem XML do not consider this white space.
Attempts
I have tried several possible solutions, without success:
<fo:block>
<xsl:number/><fo:inline white-space="pre"> </fo:inline><xsl:value-of select="@title"/>
</fo:block>
or
<fo:block>
<xsl:number/><fo:inline margin-left="0.5cm"><xsl:value-of select="@title"/></fo:inline>
</fo:block>
None of those ideas produce an acceptable result.
The question:
How to include a white space between two (inline) elements?
To insert blank spaces in text in HTML, type for each space to add. For example, to create five blank spaces between two words, type the entity five times between the words. You do not need to type any spaces between the entities.
When it comes to margins and padding, browsers treat inline elements differently. You can add space to the left and right on an inline element, but you cannot add height to the top or bottom padding or margin of an inline element. Inline elements can actually appear within block elements, as shown below.
Change the line spacing in a portion of the document Select the paragraphs you want to change. Go to Home > Line and Paragraph Spacing. Choose the number of line spaces you want or select Line Spacing Options, and then select the options you want under Spacing.
Try:
<fo:block>
<xsl:number/>
<xsl:text> </xsl:text>
<xsl:value-of select="@title"/>
</fo:block>
Or:
<fo:block>
<xsl:number/>
<xsl:value-of select="concat(' ', @title)"/>
</fo:block>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With