Catalog values used to resolve elements of the FOP configura

Here should go questions about transforming XML with XSLT and FOP.
pbw
Posts: 24
Joined: Sat Jul 12, 2008 3:46 am
Location: Brisbane, Australia

Catalog values used to resolve elements of the FOP configura

Post by pbw »

I have managed to get a catalog to work with the custom stylesheet, specifying the href for xsl:import, for example.

However, these catalog values do not work for resolving URIs in the fop config file.

How can I specify catalog values that can be used in resolving the FOP config?
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: Catalog values used to resolve elements of the FOP configura

Post by sorin_ristache »

Hello,

The XML catalogs configured in Preferences are not used for resolving URIs from the FOP config file. I do not understand what URIs of the FOP config file you would need to pass through an XML catalog.

Do you have other URIs than the ones from the embed-url attribute of the font element? Can you give an example? The embed-url attribute usually specifies a path to a font file stored in a fonts folder on the local computer, for example on Windows it can be:

Code: Select all

<font metrics-url="symbol.xml" kerning="yes" 
embed-url="file:/C:/Windows/Fonts/symbol.ttf">
<font-triplet name="symbol" style="italic"
weight="bold"/>
</font>
Regards,
Sorin
pbw
Posts: 24
Joined: Sat Jul 12, 2008 3:46 am
Location: Brisbane, Australia

Re: Catalog values used to resolve elements of the FOP configura

Post by pbw »

Sorin,

Thanks for the reply. I've been away, hence the delay in replying.

It is indeed the font and embed URIs that I want to resolve. My problem is that I am developing customisations which I hope will be widely used within the company. At the moment, MS Word is the only tool for generating corporate-labelled documents. Unless I can provide a simplified way for other users to specify the locations of their files, including font files, I am unlikely to persuade many to adopt DocBook and Oxygen.

That's why I was hoping that the one catalog file could serve all of these purposes.

My current catalog includes

Code: Select all

    <rewriteURI rewritePrefix="file:///opt/nb/oXygen/fonts/" uriStartString="file:///fonts/"/>
<rewriteURI rewritePrefix="file:///opt/nb/oXygen/metrics/" uriStartString="file:///metrics/"/>
<rewriteURI rewritePrefix="file:///opt/nb/oXygen/" uriStartString="file:///oxygen/"/>
<rewriteURI rewritePrefix="file:///opt/nb/oXygen/fonts/" uriStartString="fonts/"/>
<rewriteURI rewritePrefix="file:///opt/nb/oXygen/metrics/" uriStartString="metrics/"/>
This works for URIs in the custom.xsl file, but FOP doesn't see it.

FOP has support for catalogs, although I have never used it in the past, and I believe that XEP also has catalog support, although to judge from the forum, it is either limited or obscure to configure.

Any advice on this would be appreciated.

Thanks

Peter
pbw
Posts: 24
Joined: Sat Jul 12, 2008 3:46 am
Location: Brisbane, Australia

Re: Catalog values used to resolve elements of the FOP configura

Post by pbw »

I've looked at FOP a little further.

In order use a catalog resolver, you need
1) the resolver.jar in the classpath of the process executing FOp
2) the system property
-Dxml.catalog.files="C:/Dev/Java/workspace/FOP Main Sandbox/src/xml/fop-demo-catalog.xml"

What's the best way to go about this within the context of oxygen?

Peter
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: Catalog values used to resolve elements of the FOP configura

Post by sorin_ristache »

Hello,

You can use the FOP libraries and resolver.jar which comes with Oxygen for configuring the built-in FOP as an external FO processor. You can configure FOP from menu Options -> as in this screenshot. The command line of the external FO processor should be like:

Code: Select all

java -cp "${oxygenInstallDir}/lib/xercesImpl.jar;${oxygenInstallDir}/lib/fop.jar;${oxygenInstallDir}/lib/avalon-framework-4.2.0.jar;${oxygenInstallDir}/lib/batik-all-1.6.jar;${oxygenInstallDir}/lib/commons-io-1.3.1.jar;${oxygenInstallDir}/lib/xmlgraphics-commons-1.2.jar;${oxygenInstallDir}/lib/commons-logging-1.0.4.jar;${oxygenInstallDir}/lib/saxon9.jar;${oxygenInstallDir}/lib/saxon9-dom.jar;${oxygenInstallDir}/lib/xalan.jar;${oxygenInstallDir}/lib/serializer.jar;${oxygenInstallDir}/lib/resolver.jar" -Dxml.catalog.files="C:/Dev/Java/workspace/FOP Main Sandbox/src/xml/fop-demo-catalog.xml" org.apache.fop.cli.Main -fo ${fo} -${method} ${out}
In the transformation scenario you have to select the defined external FO processor on the FO Processor tab.

Instead of configuring an external FO processor with an XML catalog you can distribute an Oxygen project to all the users that contains both the FOP configuration file, the transformation scenarios in which the built-in FOP uses this configuration file and the font metrics files needed by the FOP configuration file. Each user loads this project and runs a scenario in which the FOP configuration file included in the project is used.


Regards,
Sorin
Post Reply