[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: xsl-fo? center external-graphic and align start si
At 2009-12-08 11:13 -0800, Jack Bates wrote:
I want some XSL-FO external-graphics to appear centered on the page, with captions underneath There are no pre-built semantics for such a choice as you have expressed. Remember there is no feedback loop from the formatter to your transformation, so you have to find a way of expressing any contingencies by using the already-available semantics in the formatting language. And measuring formatted items, or comparing the lengths of formatted items, is not available for any kind of comparison. To achieve this I wrapped both the external-graphic and the caption in blocks, then wrapped both those blocks in one block, and set text-align="center" on that block's container. Then I set text-align="start" on the caption's block. I hoped this would have the effect of centering the block containing both external-graphic and caption, and aligning the caption against the start side of that block. Nope ... because blocks are as wide as their closest ancestral reference area. I'm thinking you will have to know the width of the graphic explicitly in advance, and then you can create a container of that width and flow your caption into that container. Wait ... have you tried centring a border-less table with auto-width? Put both blocks into a single table cell in a single row. The XSL-FO default for table-width is an automatic calculation made by the formatter, so hopefully it will be as tight as either the graphic or the caption but no bigger. Then, the way one centres a table with XSL-FO is to put it in a table-and-caption and use text-align= (which is the standard way to do inline-progression-direction centring) on the table-and-caption to align the child table. You typically then need another text-align= on the table to reset the alignment for the table cells (unless you want them centred as well). That might get you closer to what you want. I hope this helps. . . . . . . . . . . . Ken -- XSLT/XQuery/XPath training after http://XMLPrague.cz 2010-03-15/19 Vote for your XML training: http://www.CraneSoftwrights.com/s/i/ Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video Video lesson: http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18 Video overview: http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18 G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/s/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|