You may want to try white-space-collapse="false" as an attribute on your
fo:block.  There are also other white space attributes that may be useful.
I'm not sure if all are supported in fop 0.20.4.


-----Original Message-----
From: Stephen Haberman [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, November 05, 2002 1:00 AM
To: [EMAIL PROTECTED]
Subject: breaking paragraphs and lines

Hi,

After much debate between whether I'd pick up LaTeX or XML-FO as my
preferred environment for writing reports and the like, I went with
XML-FO, FOP specifically, and have been enjoying it so far (ah, clean
separate of data and presentation).

However, I've run into a small problem I thought some others might be
able to shed some light on.

One of the things I liked about LaTeX was that two newlines were taken
to mean separate paragraphs. As far as reproducing this before with FOP
using XML/XSLT is that I'd probably have to:

1) Use Xalan to stitch XML/XSLT together. All text blocks would be in
generic fo:blocks, e.g.:

<fo:block color="grey">
  <fo:block>
    text

    text
  </fo:block>
</fo:block>

2) Run this result through a text manipulation program to replace all of
the \n\n with </fo:block><fo:block> to simulate a paragraph break.

3) Run this result through FOP.

I'm thinking this will work once I get some scripts setup for it, but
I'm just wondering if there is a better, within-FO/FOP way?

Also, a subset of this problem is that I was wanting to have a little
bit of control over breaking from the XML file, e.g. force a line break.
E.g.:

<content>
   This is a long line that I want broken<br/>here.
</content>

So I was going to use the same approach of a double <fo:block> to put
the text in, but then have a match against br and insert an artificial
block/inline-container type thing. The problem is that the match against
br has to look like:

<xsl:template match="br">
  <xsl:text disable-output-escaping="yes">
    &lt;/fo:block&gt;
    &lt;fo:block&gt;
  </xsl:text>
</xsl:template>

With straight Xalan, the result is exactly what I want... the closing,
opening fo:block comes out in XML just like the previous opening
fo:block. However, FOP seems to ignore this
disable-output-escaping="yes" attribute and I see the literal
"</fo:block><fo:block>" text in the PDF instead of it being interpreted
it as FO commands. If I run the result of Xalan on the same XML/XSLT
file through FOP via -fo, then it works great.

Any insight into either of the two issues I'm pondering would be greatly
appreciated. This is fun stuff.

Thanks,
Stephen
This electronic transmission is strictly confidential to Smith & Nephew and
intended solely for the addressee.  It may contain information which is
covered by legal, professional or other privilege.  If you are not the
intended addressee, or someone authorized by the intended addressee to
receive transmissions on behalf of the addressee, you must not retain,
disclose in any form, copy or take any action in reliance on this
transmission.  If you have received this transmission in error, please
notify the sender as soon as possible and destroy this message.

Reply via email to