no line wrap please

Here should go questions about transforming XML with XSLT and FOP.
Cinimod
Posts: 3

no line wrap please

Mon Mar 14, 2005 1:55 am

Hi,

I have a problem with the following piece of code:

<fo:block ???>
Name: <xsl:value-of select="name"/>,
Age: <xsl:value-of select="age"/>,
City: <xsl:value-of select="city"/>
</fo:block>

FOP creates the document with a line break after the age value - but there ist still enough room, so that no break is actually needed there.

The representation in the document I want is just a single row:

Name: xxx, Age: xxx, City: xxx


what attribute ??? and what attribute-value do I have to set, that it works as I want?

Thanks for help!
sorin_ristache
Posts: 4144

Mon Mar 14, 2005 6:03 pm

Hello,

Probably the value of the page-width attribute of the FO page master element that includes your FO block is too small. Or the font size is too large. This is a simple FO document that sets the page width and height for the North American Letter format (8.5in x 11in) and displays your text without breaking the line. You can set any values you need for the attributes page-width and page-height. If you need a smaller page width and the line breaks you can set a smaller font size, for example add the attribute font-size="8pt"to the fo:block element.

Code: Select all

<?xml version="1.0"?>
<fo:root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:fo="http://www.w3.org/1999/XSL/Format">
  <fo:layout-master-set>
    <fo:simple-page-master master-name="page1" page-width="8.5in"
      page-height="11in" margin-top="0.5in" margin-bottom="0.5in"
      margin-left="1in" margin-right="1in">
      <fo:region-body margin="1in"/>
    </fo:simple-page-master>
    <fo:simple-page-master master-name="rest-of-pages" page-width="8.5in"
      page-height="11in" margin-top="0.5in" margin-bottom="0.5in"
      margin-left="1in" margin-right="1in">
      <fo:region-body margin="1in"/>
    </fo:simple-page-master>
    <fo:page-sequence-master master-name="my-sequence">
      <fo:single-page-master-reference master-reference="page1"/>
      <fo:repeatable-page-master-reference master-reference="rest-of-pages"/>
    </fo:page-sequence-master>
  </fo:layout-master-set>
  <fo:page-sequence master-reference="my-sequence">
    <fo:flow flow-name="xsl-region-body">
      <fo:block>Name: name-here ,
                      Age: age-here,
                      City: name-of-city-here
      </fo:block>
    </fo:flow>
  </fo:page-sequence>
</fo:root>


Regards,
Sorin
Cinimod
Posts: 3

Wed Mar 16, 2005 3:09 am

thanks for this advice...but I have to change my code:

<block font-style="italic"><xsl:value-of select="name"/></block>
<block><xsl:value-of select="city"/></block>

still the problem that there is not a single line as fop output.
xacobea
Posts: 5

Wed Mar 23, 2005 12:22 pm

hi,

try to write everything in one line and use a &#160;:
<fo:block>Name:&#160;<xsl:value-of select="name"/>,Age:&#160;<xsl:value-of select="age"/>,City:&#160;<xsl:value-of select="city"/></fo:block>

or maybe try to use fo:inline instead of fo:block, a fo:block always forces a line break, anyhow why do you have to change your code and add all the fo:blocks?

Return to “XSLT and FOP”

Who is online

Users browsing this forum: No registered users and 1 guest