RE: breaking paragraphs and lines

2002-11-06 Thread Stephen Haberman
> 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.

Very cool. I'm really surprised to see how powerful, though arcane, XSLT
is. I naively thought that since I can't write imperatively, it's not a
programming language, and if something isn't in the XSL spec, it's
hard/impossible to do.

But with the hint of the tokenizing stuff be trivial, I took the
initiative I should have had before and found some 3rd
libraries/algorithms to do the \n\n ->  conversion. Nice.

> > 
> >This is a long line that I want brokenhere.
> > 
> Search in the archive - that's faq, you can use either  or
unicode
> line separator (
).

Egads. Sorry for not following the best practice of searching the
archives. This little topic of breaking is mentioned all over the place.

> > 
> >   
> > 
> > 
> >   
> > 
> 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.

Huh. Interesting.

Thanks for all the great information, things are going much smoother
now. And sorry for not doing my homework first; I really should have
known better.

- Stephen



breaking paragraphs and lines

2002-11-05 Thread Stephen Haberman
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.:


  
text

text
  


2) Run this result through a text manipulation program to replace all of
the \n\n with  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.:


   This is a long line that I want brokenhere.


So I was going to use the same approach of a double  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:


  


  


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
"" 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