3

我正在FOP使用我想在单词之间保留空格的文件来实现XSLT。 这就是我的样子:XML
XML

   <lines>
        <line1>       My Creation       </line1>
        <line2>                                 address one AAAAAAAAAAA</line2>
        <line3>            This is the              address of creation</line3>
   <lines>

以下是以下形式的结果PDF

  My Creation
  address one AAAAAAAAAAA
  This is address of creation

但我需要它是这样的:

                My Creation       
                                          address one AAAAAAAAAAA
                     This is the              address of creation

因此保留所有空间。我使用了以下行:

  <xsl:preserve-space elements="*"/>

但无济于事。
我用谷歌搜索解决方案,但徒劳无功。
任何帮助,将不胜感激。

4

1 回答 1

5
<fo:block font-family="monospace" white-space="pre" text-align="left">
    <xsl:value-of select="." />
</fo:block>
  1. white-space="pre"将保留空格
  2. font-family="monospace"将使空格的大小与字符的大小相等
于 2012-08-07T05:46:01.813 回答