Note that there are some explanatory texts on larger screens.

plurals
  1. POInserting a line break in a PDF generated from XSL FO using <xsl:value-of>
    primarykey
    data
    text
    <p>I am using XSL FO to generate a PDF file containing a table with information. One of these columns is a "Description" column. An example of a string that I am populating one of these Description fields with is as follows:</p> <pre><code>This is an example Description.&lt;br/&gt;List item 1&lt;br/&gt;List item 2&lt;br/&gt;List item 3&lt;br/&gt;List item 4 </code></pre> <p>Inside the table cell that corresponds to this Description, I would like the output to display as such:</p> <pre><code>This is an example Description. List item 1 List item 2 List item 3 List item 4 </code></pre> <p>I've learned from searching elsewhere that you can make line breaks in XSL FO using an <code>&lt;fo:block&gt;&lt;/fo:block&gt;</code> within another <code>&lt;fo:block&gt;</code> element. Therefore, even before I parse the XML with my XSL stylesheet, I replace all occurrences of <code>&lt;br/&gt;</code> with <code>&lt;fo:block/&gt;</code>, so that the literal value of the string now looks like:</p> <pre><code>This is an example Description.&lt;fo:block/&gt;List item 1&lt;fo:block/&gt;List item 2&lt;fo:block/&gt;List item 3&lt;fo:block/&gt;List item 4 </code></pre> <p>The problem arises when the Description string I am using is obtained using <code>&lt;xsl:value-of&gt;</code>, example as follows:</p> <pre><code>&lt;fo:block&gt; &lt;xsl:value-of select="descriptionStr"/&gt; &lt;/fo:block&gt; </code></pre> <p>In which case, the value that gets output to my PDF document is the literal value, so it looks exactly like the previous example with all the <code>&lt;fo:block/&gt;</code> literals. I've tried manually hard-coding the <code>&lt;fo:block/&gt;</code> in the middle of another string, and it displays correctly. E.g. if I write inside my stylesheet:</p> <pre><code>&lt;fo:block&gt;Te&lt;fo:block/&gt;st&lt;/fo:block&gt; </code></pre> <p>It will display correctly as:</p> <pre><code>Te st </code></pre> <p>But this does not seem to happen when the <code>&lt;fo:block/&gt;</code> is inside the value of an <code>&lt;xsl:value-of select=""/&gt;</code> statement. I've tried searching for this on SO as well as Google, etc. to no avail. Any advice or help will be greatly appreciated. Thank you!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload