Bug 54098 - FOP is too strict: URIs containting backslashes are not resolved in FOP 1.1
Summary: FOP is too strict: URIs containting backslashes are not resolved in FOP 1.1
Alias: None
Product: Fop - Now in Jira
Classification: Unclassified
Component: general (show other bugs)
Version: 1.1
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: fop-dev
Depends on:
Reported: 2012-11-05 08:54 UTC by Dan Caprioara
Modified: 2012-11-07 07:30 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description Dan Caprioara 2012-11-05 08:54:10 UTC
When publishing DITA or Docbook to PDF (on a Windows machine) there are created FO files containing references to images. Some of the references are respecting the URI syntax, others are using the backslash: "\". This is not under the control of the end users. The XSLT stylesheets from these documentation frameworks are generating these invalid URIs.

FOP 1.0 translated the back-slashses to forward slashes before attempting to parse the URIs. 
FOP 1.1 kept this translation in: org.apache.fop.apps.FOURIResolver but not in:

I propose adding the following code in:
org.apache.fop.fo.properties.URIProperty.Maker.make(PropertyList, String, FObj)

value = value.replace('\\', '/');

This will make FOP more compatible with the Docbook and DITA output.
Comment 1 Glenn Adams 2012-11-05 12:23:06 UTC
As a user, you choose what XSLT stylesheets to use. If you use one that contains broken references, then you suffer the consequences. The correct way to handle this is get those broken XSLT stylesheets fixed, and not require FOP to accept invalid input to accommodate such brokenness.
Comment 2 Dan Caprioara 2012-11-06 13:24:15 UTC
Thank you for the detailed answer.
Comment 3 Radu Coravu 2012-11-07 07:30:09 UTC
For more than 6 years Apache FOP has behaved in a certain way.

This means that all projects which created XSL-FO as output could have produced references which are either local file references (like Docbook does when producing references to Note images) or URL paths which may contain "\" in them like the DITA Open Toolkit does.
Such invalid references are still handled by commercial FO applications like RenderX XEP or Antenna House because they are more interested in generating the PDF than in breaking the XSL-FO transformation.

Could you add in the FOP configuration file a special setting which would overpass this problem (show it as a warning) instead of signaling it as an error?
This is what the producer of the Saxon XSLT processor did when he decided to no longer handle file references to XSLT files (instead of URI references).

I understand that by default FOP could fail with a fatal error but you have to give the projects which produce XSL-FO (and there could be many) some time to upgrade their handling of image references and in the meantime to have users benefit of the latest bug fixes available in Apache FOP.

We are the manufacturers on an XML Editor (Oxygen XML Editor), our editor comes bundled with a lot of open source software and is used to publish using a lot of open source software so upgrading the bundled FOP libraries to FOP 1.1 is a problem for us.