RELATIVE PATH from xsl (cocoon) to apache root for external graphics
Robert Jaeger
Ranch Hand
Joined: Apr 29, 2002
Posts: 62
posted
0
Hi! I am generating PDF files (containing images) with Cocoon. Unfortunately the integration of images (external-graphic) works only on windows and only with absolute path descriptions:
How can I get to my apache [root]/images directory? It doesn�t work with "../". I tried a lot of different paths. And why Linux doesnt understand the above presented code. Do I have to use back-slashes? Where exactly? Hope you can help me, Robert.
Balaji Loganathan
author and deputy
Bartender
Joined: Jul 13, 2001
Posts: 3150
posted
0
You can set the base directory of the FOP using /conf/userconfig.xml file <entry> <key>baseDir</key> <value></value> </entry>
Thanks for your help! But I cannot find this file or something similar? Do you have an idea? Robert.
Balaji Loganathan
author and deputy
Bartender
Joined: Jul 13, 2001
Posts: 3150
posted
0
Originally posted by Robert Jaeger: Thanks for your help! But I cannot find this file or something similar? Do you have an idea? Robert.
Actually that file comes with fop package. If you are using servlet to generate PDF file dynamically for the given xml file... then in your servlet file try to add the following code before you can the Driver object String basepath = file:"+getServletContext().getRealPath("/images"); org.apache.fop.configuration.Configuration.put("baseDir",basepath); this will assign the absolute path to baseDir inspite of windows or unix..
later in your xsl file you can simply call the graphic file name like <fo:external-graphic src = "test.gif"></fo:external-graphic>