xsl-list
[Top] [All Lists]

Re: Wrapping text in XSL-FO table

2003-02-28 20:57:12
Hello ,
I am constructing a simple table as below in XSL-FO.
If you observe I am putting value in 2nd column as
<xsl:value-of select="." /> using XSLT. It works fine
as told by you, but I have found it fails in 1 case.
When the string length of <xsl:value-of select="." />
(i.e. of the data element) is greater than the column
width i.e. 108 pt, that word is not split and brought
to next line, but it overflows the column boundary. I
need that a long word whose length is greater than the
column width should be split at the column boundary(as
it happens in MS Word). Is there any property in
XSL-FO for this, or am I missing something..

<fo:table white-space-collapse="false"
font-size="10pt" font-family="sans-serif"
table-layout="fixed">
  <fo:table-column column-width="115pt"/>
  <fo:table-column column-width="108pt"/>
    <fo:table-body>                      
      <fo:table-row>
           <fo:table-cell>
              <fo:block>Name</fo:block>
           </fo:table-cell>
           <fo:table-cell>
             <fo:block><xsl:value-of select="." /></fo:block>
           </fo:table-cell>
       </fo:table-row>
    </fo:table-body>
</fo:table>     

Regards,
Mukul

--- "W. Eliot Kimber" <eliot(_at_)isogen(_dot_)com> wrote:
Mukul wrote:
Hello ,
  I am constructing a XSL-FO table. I want a
sentence
wrapping effect like as in MS Word. When something
is
typed in a table row, I need 2 conditions to be
fulfilled -
1) When a word touches the column boundary , the
whole
word wraps to the next line(the word is not split)

This is normal behavior unless you explicitly turn
off line breaking.

2) If length of word is greater than the column
width,
the word is split and continues on the next line

You will have to turn on hyphenation and probably
change the 
hyphentation character (if you don't actually want a
hyphen when a word 
breaks).

Different implementations may behave differently
when flowing text into 
constrained spaces--XEP, for example, never breaks
words unless 
hyphentation is on, XSL Formatter may. The FO
specification leaves these 
details of line breaking up to implementations.

Cheers,

Eliot
-- 
W. Eliot Kimber, eliot(_at_)isogen(_dot_)com
Consultant, ISOGEN International

1016 La Posada Dr., Suite 240
Austin, TX  78752 Phone: 512.656.4139


 XSL-List info and archive: 
http://www.mulberrytech.com/xsl/xsl-list



__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
http://taxes.yahoo.com/

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list