Stephen Haberman wrote:

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?
Processing xml as text is kinda dangerous, especially when you are trying to fiddle with tags, I believe a better and more safe way is to handle \n\n stuff one stage earlier - during fo generation, that's pretty simple in xslt to tokenize string into blocks by any delimiter, trivial recursive template can do that.

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>
Search in the archive - that's faq, you can use either <block/> or unicode line separator (&#x2028;).

<xsl:template match="br">
  <xsl:text disable-output-escaping="yes">
    &lt;/fo:block&gt;
    &lt;fo:block&gt;
  </xsl:text>
</xsl:template>
Wrong way, disable-output-escaping implies serialization of a result tree hence doesn't work otherwise, e.g. in mozilla, cocoon and fop. This facility is for generating text (e.g. SQL), but not markup.

--
Oleg Tkachenko
eXperanto team
Multiconn Technologies, Israel



Reply via email to