FOPRunXSLTExt - Example 4 - List item label width

From
http://www.w3.org/community/ppl/wiki/FOPRunXSLTExt#Example_4_-_List_item_label_width:

------------------------------------------

Adjusts the lengths allowed for list items to exactly fit the formatted
width of the list item labels.

This demonstrates a solution to requirement #9, "Ability to modify label
field width in a single list when labels are large", from
CustomerRequirements.

'example4.xml' includes two lists that, when transformed with
'formatting.xsl' and formatted, have list item label widths that are
either too wide or too narrow for the labels in the lists.

When transformed with 'example4_saxon9_fop10.xsl' and formatted, the list
item label widths are set based on the actual maximum formatted width of
the labels in each list. The 'example4_saxon9_fop10.xsl' stylesheet does
this by constructing a test document containing just the list item label
texts, using the extension function to format that and get the area tree,
and determining the maximum widths from the area tree. The document that
is formatted mid-transform is, unlike in previous examples, a different
document to the one used to produce the final output.

-----------------------------------------------------

I'm going to have to stop now and do real work, but the jar is on the wiki
for anybody who wants to see what you can do when you have an area tree to
play with mid-transform.

Of course, troff has had this sizing ability for decades, IIRC, and we'd
be better off if this sort of calculation was a regular part of FO
formatting rather than having to implement it like this, but it does
demonstrate making an area tree from an FO tree with a different structure
to that of the final FO tree.

Regards,


Tony.

Received on Sunday, 28 April 2013 15:50:13 UTC