Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to insert a white space between two (inline) elements?

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?

like image 639
Adrian Maire Avatar asked Aug 17 '14 09:08

Adrian Maire


People also ask

How do you add a white space in HTML?

To insert blank spaces in text in HTML, type &nbsp; for each space to add. For example, to create five blank spaces between two words, type the &nbsp; entity five times between the words. You do not need to type any spaces between the entities.

Can I give padding on inline?

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.

How do you create an inline space?

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.


1 Answers

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>
like image 142
michael.hor257k Avatar answered Oct 08 '22 01:10

michael.hor257k