[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Table columns - fixed span width with underlying

Subject: Re: Table columns - fixed span width with underlying "auto" layout columns
From: Brandon Ibach <brandon.ibach@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 24 Feb 2011 01:38:01 -0500
Re:  Table columns - fixed span width with underlying
On Wed, Feb 23, 2011 at 9:30 PM, Murray McDonald <m.mcdonald@xxxxxxxxx>
> I still need to deal with the underline part of the problem.  The length of
> the underline that should be used throughout the column is determined by
> widest data entry (excluding any data that hangs) That's why I was thinking
> of "splitting" these columns into 3 columns, one  to  hold any content that
> needs to hang, one to hold (and right-align) the numeric data and also
> correctly "size" the underlines, and the leftmost column to pad the whole
> thing out to the calculated width.

Instead of the multiple columns, how about a variation on the hidden
inline trick?  This one is going to be a bit more complex and bloat
your FO code a bit, but with XSLT doing the heavy lifting, who cares,
eh? :)

Assuming you have negative percentages somewhere in the table (so you
need to leave space for both "%" and ")"), then for a value of -$123
(rendered as "($123)"), you'd have something like this:

<block line-height="1">
        <!-- block-containers -->
    <inline>)</inline><inline visibility="hidden">%</inline>

The inlines at the end are for the visible and invisible hanging
punctuation, respectively.  The line-height on the outer block is to
prevent the line getting extra tall due to the nested blocks.  The
inline-container sets up a reference area in which we can position
other blocks, which brings us to the block-containers, of which there
will be one for each data entry in the column (the entire column being
copied, in this form, in every row), like this:

<block-container absolute-position="absolute" bottom="0" right="0">
        <inline border-bottom="solid 1pt black">
            <inline visibility="hidden">($123</inline>

Each block-container is anchored in the lower-right corner of the
inline-container, so they all stack on top of each other.  The actual
text content is hidden, but provides the correct width for the inline
wrapper with a bottom border.  Because all of the values in the column
are in the "stack", the visible result is a line as long as the widest

-Brandon :)

> On 23/02/2011 7:45 PM, Brandon Ibach wrote:
> The most elegant solution I can think of would be to use the
> text-align="<string>" property to align the numeric values on a
> zero-width space between the final digit and any "%" or ")", but the
> documentation on XEP indicates that it doesn't support that feature.
> The next best choice would probably be the multi-column solution, only
> I think you should be able to do it with just two columns, as I don't
> see the need for the one to the left.  I'm not completely clear on how
> you're doing the layout, though.  Is your XSLT calculating fixed
> widths for each column, or are you relying on XEP to do auto-layout?
> I can think of one other option that might work, though it is a bit of
> a hack.  Pre-scan the content in your XSLT to determine if any entries
> will need a "%", a ")" or both.  Then, while generating each entry,
> add any of those symbols not needed by that entry in an<fo:inline
> visibility="hidden">  at the end.  Combined with text-align="right" on
> the block (and possibly a keep-together to make sure there's no
> wrapping), this should reserve the needed space to line everything up.
> -Brandon :)

Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.