Re: [xsl] Table columns - fixed span width with underlying "auto" layout columns

Subject: Re: [xsl] Table columns - fixed span width with underlying "auto" layout columns
From: Brandon Ibach <brandon.ibach@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 23 Feb 2011 19:45:52 -0500
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 :)


On Wed, Feb 23, 2011 at 5:01 PM, Murray McDonald <m.mcdonald@xxxxxxxxx>
wrote:
> I am writing an XSLT to produce XSL-FO.  I am using the RenderX engine.
>
> I have a table with a 5 columns.  The last four columns are columns of
> numbers with text headers.  The XSLT can calcuate how wide it would like
> each of these columns to be.  The numbers normally represent thousands of
> dollars but are sometimes percentages and sometimes are enclosed within
> parenthesis to indicate a debit.  The formatting requirement is to "hang"
> any trailing close parenthesis or percent charcater (or both) such that the
> last digit of each number aligns vertically.  On cells with a rowsep I also
> need to include an underline or double-underline but the length of that
> underline should only be as wide as the widest numeric entry within the
> column.
>
> One possibility might be to break each of these single columns into three
> columns. The rightmost column would be to hold ")", "%" or %)" if present,
> the fo:block in such a cell would use text-align="left".  The "middle"
> column would hold the dollar figure and any open parenthesis; the fo:block
> in such a cell would use text-align="right".   If an underline or double
> underline is required it would be applied to this "middle" cell only.  The
> leftmost column would be empty and would be used to "pad" the total span of
> the three cells out to the desired width.  The column headers would span
the
> three cells.
>
> I don't see anything in the specs that suggest this should work but I've
> tested a number of solutions.  The best of these makes the first of the
> three coumns the width I desired for all three and does get "minimum"
widths
> for my two rightmost columns but it expands the total width of the table by
> the width of these two columns.
>
> Looking at the FAQ and the archive, the most promising solution I can see
it
> to use the "InnodataSaxonExtensions" in the XSLT step to measure the text I
> am setting and then used fixed table layouts.
>
> If anyone has thoughts or comments on this I would appreciate hearing them.
>
> Thanks very much

Current Thread