Re: [xsl] placing graphics side by side with xsl-fo

Subject: Re: [xsl] placing graphics side by side with xsl-fo
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Mon, 23 Nov 2009 18:56:46 -0500
At 2009-11-23 17:07 -0500, Flanders, Charles E (US SSA) wrote:
I have no real experience with XSL-FO. I've been working on XML to XML transforms. However, I've been asked to modify an XSL-FO stylesheet to display subfigures side by side. Right now they are rendering one over the other.

Essentially, I need each <subfig> to render side by side, not over/under.

If I've understood your code correctly, you've put them each in block containers and block containers that are not absolutely positioned will stack in the block progression direction.


Here is the basic XML.

<figure>
<title>TITLE</title>
<subfig><graphic boardno="it1235"/></subfig>
<subfig><graphic boardno="it1234"/></subfig>
</figure>

The current templates:

... were too confusing to determine your needs for captioning, positioning, alignment, etc.


Since graphics are inline constructs, you can put both on the same line, say with a half-centimeter separation, as follows:

  <block>
    <external-graphic src='url("it1235")'/>
    <leader leader-length=".5cm"/>
    <external-graphic src='url("it1234")'/>
  </block>

If each sub-figure has independent captioning requirements, then it will have to be more elaborate. Some processors support <inline-container> and you can put two of those on a line and in each one you can put a line with the figure and other lines with your captions. Without <inline-container> support you might consider using a single item list construct to provide the scaffolding for your blocks.

Once you figure out what works, then you can adjust your XSLT accordingly.

When I try to determine what I need in my XSLT I will often write the XSL-FO by hand and test it ... which will tell me what constructs I need where. Then I worry about the XSLT to get there. Take the output of what you have now, tweak the end result and test it without running XSLT, and then fix the XSLT.

I hope this helps.

. . . . . . . . . . . Ken

--
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

Current Thread