Subject: Re: [xsl] [xsl-fo] tagging for poems (widows, orphans, keep-together) From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Mon, 27 Sep 2010 14:24:55 -0400 |
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.
<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.
My questions: 1. Is it true that settings for widows and orphans are only working when there are no sub-blocks in a block?
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.
* 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@xxxxxxxxxxxxxxxx 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 ======================================================================
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] [xsl-fo] tagging for poems (w, Christian Kirchhoff | Thread | [xsl] xsl-fo: keep-with-next "alway, Christian Kirchhoff |
Re: [xsl] Why is the variable and r, Michael Kay | Date | Re: [xsl] xsl-fo: keep-with-next "a, Wendell Piez |
Month |