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

Reply via email to