[xep-support] text in a box

G. Ken Holman gkholman at CraneSoftwrights.com
Mon Apr 12 11:08:36 PDT 2004


At 2004-04-12 10:31 -0700, Bob Stayton wrote:
>I'm trying to do something I thought would be easy, but I can't seem to find
>a way that works.  I'm trying to present a set of fixed lines of text inside
>a box.  The linefeeds are preserved, and the box should just fit around the
>lines:
>
>+---------------------------+
>|First line                 |
>|Another line that is longer|
>|Third line                 |
>+---------------------------+
>
>[this won't display properly in a proportional font. You should see the
>right side of the box just containing the longest line of text]
>
>When I add a border to the container block, the box extends all the way
>across the page.

Yes, because the unspecified width is the width of the parent.

>I only want it to extend just past the longest line of
>text.  I can't set a width on the container  block because I don't know what
>the width will be since it is determined by the text.

Very little in XSL-FO responds to the width of the text.

>I tried a table, but ran into similar problems of the table always extending
>the width of the page unless I specify explicit column widths, which I
>cannot.

Using table-layout="auto" (which is the XSL-FO 1.0 default) would probably 
work for you, but I do not know where in the XEP priority list you will 
find the addition of support for this property.  This is how I would do it 
if the feature were available to me.

I then thought of using a side-float with a block that is bordered, and 
that works for me in XEP.  Sample FO is below.

I hope this helps.

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


   <block clear="start">
     What follows is a tightly bordered box of monospaced text.
   </block>
   <float float="start">
     <block border="solid"
            linefeed-treatment="preserve"
            white-space-treatment="preserve"
            white-space-collapse="false">First line
Another line that is longer
Third line
     </block>
   </float>
   <block clear="start">
     What follows is a tightly bordered box of monospaced text using a table.
   </block>
   <table table-layout="auto">
     <table-body>
       <table-cell>
         <block border="solid"
                linefeed-treatment="preserve"
                white-space-treatment="preserve"
                white-space-collapse="false">First line
Another line that is longer
Third line
         </block>
       </table-cell>
     </table-body>
   </table>


--
Public courses: Spring 2004 world tour of hands-on XSL instruction
Each week:   Monday-Wednesday: XSLT/XPath; Thursday-Friday: XSL-FO
Hong Kong May 17-21; Bremen Germany May 24-28; Helsinki June 14-18

World-wide on-site corporate, govt. & user group XML/XSL training.
G. Ken Holman                 mailto:gkholman at CraneSoftwrights.com
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/f/
Box 266, Kars, Ontario CANADA K0A-2E0    +1(613)489-0999 (F:-0995)
Male Breast Cancer Awareness  http://www.CraneSoftwrights.com/f/bc

-------------------
(*) To unsubscribe, send a message with words 'unsubscribe xep-support'
in the body of the message to majordomo at renderx.com from the address
you are subscribed from.
(*) By using the Service, you expressly agree to these Terms of Service http://www.renderx.com/tos.html



More information about the Xep-support mailing list