[xep-support] how to generate a FO table with a preformatted block of text in one FO table cell

Nikolai Grigoriev grig at renderx.com
Thu May 9 12:23:17 PDT 2002


Hong,

I have tried several combinations of preformatted text
with fo:table-cell, and could not reproduce the error:
white-space-collapse and linefeed-treatment worked
in all possible cases. Could you please send a complete
sample (either a ready FO file, or an XML source +
an XSL stylesheet) to support at renderx.com so that we
can analyze it? Maybe the problems are in the XSLT part,
not XSL FO...

Best regards,
Nikolai Grigoriev
RenderX

----- Original Message -----
From: "Tang Hong - Developer" <Hong.Tang at Sun.COM>
To: <xep-support at renderx.com>
Sent: Wednesday, May 08, 2002 6:32 PM
Subject: [xep-support] how to generate a FO table with a preformatted block of
text in one FO table cell


> We are trying to generate a FO table with a preformatted block of text in one
> cell. We can generate the preformatted text in a FO block. But when we put the
> block in a table cell we lose the preformatting.
>
> Incoming text has preformatted blocks enclosed between "/<PRE/>" and
"/</PRE/>".
> They will be replaced with genuine <PRE> and </PRE> tags later. We generate
> preformatted text by putting everything between "/<PRE/>" and "/</PRE/>" in a
FO
> block. The block is set in Courier font with whitespace and linefeeds
preserved.
>
> Here is the xsl code we use. It works when we generate a FO block that is not
in
> a FO cell. It does not preserve whitespace and linefeeds when the block is in
a
> FO cell. Is there some way we can preserve whitespace and linefeeds in a table
> cell?
>
> ======================================================================
> <xsl:param name="analysis"><xsl:value-of select="@analysis" /></xsl:param>
>   <xsl:choose>
>     <xsl:when test="substring($analysis, 1, 7)='/&#060;PRE/&#062;'">
>         <fo:block space-after.optimum="1pt" space-before.optimum="2pt"
>             font-family="Courier" font-size="9pt" font-weight="normal"
>             linefeed-treatment="preserve" space-treatment="preserve"
>             white-space-collapse="false">
>             <xsl:value-of select="substring-before(substring($analysis, 8),
>     '/&#060;/PRE/&#062;')" />
>          </fo:block>
>          <fo:block font-family="Helvetica" space-after.optimum="6pt"
>       space-before.optimum="0pt"
>               font-size="11pt" font-weight="normal"
>               linefeed-treatment="preserve" space-treatment="preserve">
>              <xsl:value-of
> select="substring(substring-after(substring($analysis, 10),
'/&#060;/PRE/&#062;
> '), 2)" />
>           </fo:block>
>           </xsl:when>
>           <xsl:otherwise>
>           <fo:block font-family="Helvetica" space-after.optimum="6pt"
> space-before.optimum="2pt"
>               font-size="11pt" font-weight="normal"
>               linefeed-treatment="preserve" space-treatment="preserve">
>              <xsl:value-of select="$analysis" />
>           </fo:block>
>           </xsl:otherwise>
>           </xsl:choose>
> ======================================================================
>
> Hong
>
> -------------------
> By using the Service, you expressly agree to these Terms of Service
http://www.renderx.com/tos.html

-------------------
By using the Service, you expressly agree to these Terms of Service http://www.renderx.com/tos.html



More information about the Xep-support mailing list