Bug 41631 - Percentages in proportional-column-width() not supported
Summary: Percentages in proportional-column-width() not supported
Status: CLOSED FIXED
Alias: None
Product: Fop - Now in Jira
Classification: Unclassified
Component: fo tree (show other bugs)
Version: trunk
Hardware: All All
: P2 normal
Target Milestone: ---
Assignee: fop-dev
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-02-16 02:02 UTC by Jeremias Maerki
Modified: 2012-04-01 06:26 UTC (History)
0 users



Attachments
patch fixing the problem (1.53 KB, patch)
2008-02-07 09:22 UTC, Andreas L. Delmelle
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jeremias Maerki 2007-02-16 02:02:11 UTC
I've seen examples where a percentage was used in
proportional-column-width(numeric). FOP raises an error in this case, but I
think that's wrong. The spec says:
"Percentages are values that are counted in 1/100 units. That is, 10% as a
percentage value is 0.10 as a floating point number."
and
"For example, a value of "110%" on a "font-size" property would be evaluated to
mean 1.1 times the current font size. Such a definition of the allowed
conversion for percentages is specified on the property definition. If no
conversion is specified, the resulting value is a percentage."

http://www.w3.org/TR/xsl11/#d0e5420

I interpret this so that the proportional-column-width(20%) is, in this case,
simply converted to the numeric value 0.2. So if you consistently use
percentages to specify the column widths you'd get the expected result.

Tasks:
- Get feedback if this view is correct.
- Write a test case
- Fix the problem
Comment 1 Andreas L. Delmelle 2007-02-16 03:54:17 UTC
Agreed with the interpretation. 
proportional-column-width() takes a Numeric, so percentages should indeed be allowed, and the 
suggested way of interpreting percentage values makes a lot of sense.

Ran a quick test, and the problem seems to be:
fop.expr.PPColWidthFunction expects a number, but gets a null if percentages are specified.
RelativeNumericProperty does not override Property.getNumber()...
Comment 2 Andreas L. Delmelle 2007-02-16 04:47:01 UTC
Just FYI, adding the following simple method to PercentLength seems to do the trick:

    public Number getNumber() {
        return new Double(factor);
    }

Only seems a bit awkward to me that a percentage as a subexpression is parsed into a PercentLength 
here...
Comment 3 Andreas L. Delmelle 2008-02-07 09:21:55 UTC
update:
The attached patch should at least take care of the last task... :-)

I'll see if I can add a test case as well, so we can close this one.
Comment 4 Andreas L. Delmelle 2008-02-07 09:22:40 UTC
Created attachment 21494 [details]
patch fixing the problem
Comment 5 Andreas L. Delmelle 2008-02-10 05:44:18 UTC
Fixed in FOP Trunk.

see: http://svn.apache.org/viewvc?rev=620283&view=rev
Comment 6 Glenn Adams 2012-04-01 06:26:41 UTC
batch transition pre-FOP1.0 resolved+fixed bugs to closed+fixed