xsl-list
[Top] [All Lists]

Re: [xsl] [xsl-fo] tagging for poems (widows, orphans, keep-together)

2010-09-27 15:08:14
Dear Christian,

At 08:46 AM 9/24/2010, you wrote:
I am trying to find a good solution for tagging poems in xsl-fo. The xsl-fo is then to be converted into a PDF with XEP/RenderX.

Right now I am having problems avoiding widows and orphans. It seems (but I am not sure about that) that when there are empty fo:block tags (serving as line breaks) within a parent fo:block, then the widows and/or orphans settings don't apply.

A tagging of a poem might look like this:
<fo:block widows="5" orphans="5" hyphenate="false">
    Er folgte seinem Regiment<fo:block/>
    Ins Land, wo hoch die Palmen stehen,<fo:block/>
    Die Sonne heiß herniederbrennt<fo:block/>
    Auf Bombays Tempel und Moscheen,<fo:block/>
    Wo tausend Scenen bunt und wild<fo:block/>
    Den Sinn berauschen und umfloren,<fo:block/>
    Allein der fernen Heimat Bild<fo:block/>
    Blieb seiner Seele unverloren.<fo:block/>
</fo:block>

But though widows and orphans are set to 5, my experience is that sometimes less than 5 lines are on the beginning or the end of a page.

I should think that

<fo:block widows="5" orphans="5" hyphenate="false">
    <fo:block>Er folgte seinem Regiment</fo:block>
    <fo:block>Ins Land, wo hoch die Palmen stehen,</fo:block>
    <fo:block>Die Sonne heiß herniederbrennt</fo:block>
    ... etc ...

would be more "normal" and might even work better. But that is speculation on my part; I haven't tried it.

If I set keep-together to "always" another problem comes up. Because if a verse is very long and doesn't fit entirely on the current page, the whole verse is shifted to the next page, leaving a huge amount of white space on the current page.

That sounds right.

My questions:
1. Is it true that settings for widows and orphans are only working when there are no sub-blocks in a block?

There are really two separate questions here:

1. What does the XSL-FO standard say should happen?
2. What actually happens in the engine you are using?

It is important that these are different because they bear on what your choices are if things turn out differently from the way you want.

That being said, however, I don't know the answer to either question (sorry). I might be able to determine question 1 by looking it up, but then so could you. :-)

I could also make an educated guess ... which would go along with trying the code I've offered above ... but why guess?

2. What would be an appropriate tagging for poems in order to achieve my goal (avoiding widows and orphans but NOT placing verses that are too big on the next page)

I think that depends on the answers to the above. First you need to determine whether there is a correct way to do it that works in your tool. If there isn't, you will need a workaround.

I suggest you do a bit more research, including:

 * Consult the XSL Recommendation on widows, orphans and blocks
* Try out your code and variations thereof in a different engine to help determine any variance in conformance or interpretation of the FO.

Beyond that, this is the kind of question that an XSL-FO expert (not necessarily an XSLT expert) *might* be able to answer off the top of their head. And there's no harm in asking.

Good luck,
Wendell




======================================================================
Wendell Piez                            
mailto:wapiez(_at_)mulberrytech(_dot_)com
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
  Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>