You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by Emilio Arce <ea...@dataware.com> on 2000/09/21 23:04:53 UTC
Preserving original format
I've been using Cocoon to do some transformations on documents from XML to
HTML. Now, at the stage of transforming XML docs to PDF, and I run into the
following problem.
I'm bringing the content of a file into the stylesheet and then trying to
put it in a fo:block but I want to preserve the line breaks and indentations
(ala HTML's <pre></pre>) I haven't been very successful with this. It just
puts the text as it comes without preserving new lines or tabs. I tried
using linefeed-treatment="preserve" but that didn't work. Any ideas?
Here is the code that I have for this particular template:
<xsl:template match="example">
<xsl:variable name='filename' select="node()"/>
<fo:block text-align-last="centered"
linefeed-treatment="preserve"
font-size="12pt" font-style="italic"
space-before.optimum="10pt"
space-after.optimum="10pt" >
<xsl:value-of select="document(concat('../',$filename))"/>
</fo:block>
</xsl:template>
Re: Preserving original format
Posted by Herbert Hotz <he...@symmetrix.ch>.
Hi,
Perhaps you should try the following in your <fo:block> statement:
<fo:block white-space-treatment="preserve">
This works for me with FOP 13 (and I think also with FOP 12)
Cheers,
Herbert
Emilio Arce wrote:
> I've been using Cocoon to do some transformations on documents from XML to HTML. Now, at the stage of transforming XML docs to
> PDF, and I run into the following problem.I'm bringing the content of a file into the stylesheet and then trying to put it in a
> fo:block but I want to preserve the line breaks and indentations (ala HTML's <pre></pre>) I haven't been very successful with
> this. It just puts the text as it comes without preserving new lines or tabs. I tried using linefeed-treatment="preserve" but that
> didn't work. Any ideas? Here is the code that I have for this particular template:<xsl:template match="example">
> <xsl:variable name='filename' select="node()"/>
> <fo:block text-align-last="centered"
> linefeed-treatment="preserve"
> font-size="12pt" font-style="italic"
> space-before.optimum="10pt"
> space-after.optimum="10pt" >
> <xsl:value-of select="document(concat('../',$filename))"/>
> </fo:block>
> </xsl:template>