[jira] [Created] (FOP-2706) Allow not failing when an unknown FO property is found

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

[jira] [Created] (FOP-2706) Allow not failing when an unknown FO property is found

JIRA jira@apache.org
Vincent Massol created FOP-2706:

             Summary: Allow not failing when an unknown FO property is found
                 Key: FOP-2706
                 URL: https://issues.apache.org/jira/browse/FOP-2706
             Project: FOP
          Issue Type: Improvement
    Affects Versions: 2.2
            Reporter: Vincent Massol

Rationale: on the XWiki project we use FOP to export to PDF like this:
* Generate XHTML from a wiki page and clean it
* Apply a xhtml2fo.xsl XSL stylesheet
* Run FOP on it to generate the PDF

However our xhtml2fo.xsl is far from perfect and it lets some invalid FO slip through. Of course a solution is to fix is and re-implement it as a white list of FOP-supported properties instead of what we do now which is to remove unknown properties (and we constantly find new CSS properties that make it fail). However this is going to take time and we were wondering if, in the meantime, you'd be open to add a feature in FOP to be more lenient and instead of hard failing when there are unknown properties to log a warning an continue?

Right now I have this local patch for PropertyList#convertAttributeToProperty():

Before patch:

            if (propId == -1
                    || (subpropId == -1 && subPropertyName != null)) {
                handleInvalidProperty(new QName(null, attributeName));

After patch:

            if (propId == -1
                    || (subpropId == -1 && subPropertyName != null)) {
                log.warn("Ignoring invalid property: " + attributeName);
//                handleInvalidProperty(new QName(null, attributeName));

Of course this should be done properly and a configuration option introduced so that by default it throws an exception as it does now but when the "lenient" property is set it would emit a warning instead.

AFAICS the config property should be defined in FOUserAgent, right?

WDYT? Would you be open to include this option in the fop codebase?

This message was sent by Atlassian JIRA