2
votes

i am writing the XSL-FO document and i want to set min-width values for some inline elements. For example, in the following structure

|    FirstName:         string1         LastName:         string2         |

where "string1" and "string2" are data from my XML and "|"'s denotes left and right borders, i want the following results

|    FirstName:    John     LastName:   Smith                             |
|    FirstName:             LastName:   Smith                             |
|    FirstName: SomeVeryVeryLongFirstNameOfSomePerson  LastName:  Smith   |

when respective peoples ("John" "Smith", "" "Smith", "SomeVery..." "Smith") are loaded from XML.

Basicaly i need something like this

<fo:block> 
FirstName: <fo:inline min-width="50mm"> <xsl:value-of ...> </fo:inline> LastName: <fo:inline min-width="50mm"> <xsl:value-of ...> </fo:inline>
</fo:block>

but this isn't working (min-width is ignored). I tried min-width on fo:block, tried inline-progression-dimension, block-progression-dimension, some workaround with fo:table but nothing works or i'm doing it wrong. I'm using Apache FOP 1.0.

Can anyone help? Thanks in advance

1
Exactly what isn't working? (I note that min-width wasn't supported in 0.95 xmlgraphics.apache.org/fop/compliance.html but you say you are using 1.0). I'd see if any of the examples in the FOP distro use min-width and if they do build from there.peter.murray.rust
Code above isn't working (if person iz "", "Smith", it produces "FirstName: LastName: Smith", instead of "FirstName: ________ LastName: Smith". By the way, i think min-width is not meant for <fo:inline>, but i don't know where or how to use it on other elements, there are almost no examples for "min-width" attribute. It doesn't work on fo:block (although it wont help, because i need horizontal width). I downloaded FOP 1.0 about 2 months ago, binary version, maybe they changed source.Nikola

1 Answers

0
votes

I had this problem as well, and after some search on the web, I discovered a solution: use a fo:inline-container with the desired width and a fo:block inside where you put your text:

<fo:inline-container text-align="center" width="1cm">
  <fo:block border-bottom="0.5pt solid #000">
    <xsl:value-of select="your/xpath/selector"/>
  </fo:block>
</fo:inline-container>

Just replace the width and selector to match your needs. This example also includes a bottom line, which I needed, but it is not mandatory: just remove the border-bottom from fo:block if you don't need it. See How get fixed width for inline FO? for the original solution and details.