Saving strings, etc. In XSL textual content, but not in the tags themselves

When creating an XSL document, I ran into the following problem. I want to keep line feeds in the source, so I install linefeed-treatment="preserve". However, this apparantly also means that it saves line breaks outside of the text content and in the actual xml elements. Example:

String content = "<fo:block white-space-collapse=\"true\" ><fo:inline>this is some </fo:inline><fo:inline font-weight=\"bold\">custom</fo:inline><fo:inline> \ncontent</fo:inline></fo:block>";

This is the text that I use for input. It is converted to an XML document in Java. Pay attention to \ n right before the content indicating a new line. This will lead to the following output in the FO document:

<fo:block white-space-collapse="true" linefeed-treatment="preserve">
  <fo:inline>this is some</fo:inline>
  <fo:inline font-weight="bold">custom</fo:inline>
  <fo:inline> 
content</fo:inline>
</fo:block>

Thus, it shows the line break just before the text content, which is good.

Apache FOP, PDF, , DocX. :

XSL :

<fo:block white-space-collapse="true" linefeed-treatment="preserve"><fo:inline>this is some </fo:inline><fo:inline font-weight="bold">custom</fo:inline><fo:inline> 
content</fo:inline></fo:block>

, :


, , , . ? ?

+5
2

, - .

<fo:block white-space-collapse="true" linefeed-treatment="preserve"
  ><fo:inline>this is some</fo:inline
  ><fo:inline font-weight="bold">custom</fo:inline
  ><fo:inline> 
content</fo:inline
></fo:block>

, .

+5

<xsl:output method="xml" indent="no"/> XSLT .

+1

All Articles