At 2003-12-15 16:50 -0500, Kyle Partridge wrote:
Create fo:table to format some text occurring after a fo:block.
You might be presuming too much too early in the above statement.
The XML input looks like this:
<p tabs="0.2 1.2 2.2">
some text, maybe formatted <b>maybe not</b>, and then:
Fine ... but you are describing a "Hard Problem" because you are going from
something that is unstructured to something that is structured.
And ... it seems that for all the verbiage you are writing you are failing
to explicate the essence of your formatting requirement. This is, I think,
because you are trying to describe your XSLT rather than trying to describe
your formatting requirement.
First, *before* you figure out what XSLT you want, you have to determine
what XSL-FO you want. You don't define the properties of your tab stop
attribute value, so I'm guessing these are inches along your line ... and
you don't define what happens when your text overflows a tab stop ... so
you leave people guessing what it is you want and it isn't fun guessing and
getting something wrong, so why would one volunteer a solution only to be
shown they are wrong?
Stop looking at your XSLT for now and look at the following:
<?xml version="1.0" encoding="utf-8"?><!--kyle.fo-->
some text, maybe formatted
<inline font-weight="bold">maybe not</inline>,
I've run the above in Antenna House and it looks like it might be what you
want. If it isn't what you want, study the XSL-FO semantics and express
what you want in XSL-FO until you get a rendering that will satisfy
you. Again, I'm not sure you really want to use tables since you haven't
described what you want the text to do when it overflows a tab stop: using
tables you'll get a wrap; using inline-containers you'll get either
clipping or bumped tabs (your choice).
Then ... there is no guessing about what XSL-FO you need for your desired
effect, because you are looking at it ... and you have now reduced your
problem to one of transformation instead of two (transformation and
formatting). This is what I do all the time when I am unsure of the result
... because just jumping into the transformation doesn't help if you don't
know into what you are transforming your information.
Now if the above is close to right, perhaps you can see why this is a "Hard
Problem" ... you have an unstructured and very flat collection of text and
empty elements that are all siblings (the only structure is the <b> child
with the text child), and you need to create a hierarchy that has a lot of
parent/child relationships (sibling block and table, where table has levels
of hierarchy before the low-level table contents).
It can be done, but it isn't pretty ... and it wouldn't be pretty in any
language because going uphill in a transformation is a "Hard
Problem". BTW, going downhill in a transformation (from rich hierarchy to
flat collection) is easy and is the typical transformation most people need
to write. What you are trying to do has *long* been around in legacy
conversion circles ... going from an unstructured representation of
information to a structured representation of information.
When you get the desired XSL-FO output you need, and it doesn't come to you
how to write your transformation, then you can post "Here is my XML ... and
here is my desired XSL-FO ... and the part of the transformation that I'm
having trouble with is the part where ..."
Then it will be easier for people to contribute ... and the easier you make
it for people to contribute, the more help you will probably obtain.
I hope this does help.
North America (Washington, DC): 3-day XSLT/2-day XSL-FO 2004-02-09
Instructor-led on-site corporate, government & user group training
for XSLT and XSL-FO world-wide: please contact us for the details
G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995)
ISBN 0-13-065196-6 Definitive XSLT and XPath
ISBN 0-13-140374-5 Definitive XSL-FO
ISBN 1-894049-08-X Practical Transformation Using XSLT and XPath
ISBN 1-894049-11-X Practical Formatting Using XSL-FO
Member of the XML Guild of Practitioners: http://XMLGuild.info
Male Breast Cancer Awareness http://www.CraneSoftwrights.com/s/bc
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list