Background image in XML ..Urgent !!

M

Manoj Nair

I have a XSL file which has the following code for background image.
<fo:table-body>
<fo:table-row text-align="center">
<fo:table-cell background-image="copy.gif"
border-after-style="none" border-before-style="none"
border-end-style="none" border-start-style="none" font-size="10pt"
text-align="center" padding-start="3pt" padding-end="3pt"
padding-before="3pt" padding-after="3pt" display-align="center"
border-style="solid" border-width="1pt" border-color="white">

I am running this in weblogic and during runtime the FOP parser always
looks for copy.gif in the weblogic directory which is
c:\bea\user_projects\mydomain. But I have the gif file in my web
application directory c:\xxx\yyy\ where the *.XSD file resides. What
should I set the URL to to tell the FOP parser to get the gif file
from same directory as where the XSD resides ??

Thanks
 
P

Patrick Melo

What should I set the URL to to tell the FOP parser to get the gif
file from same directory as where the XSD resides ??

1. Write an action to pass the path to the sitemap.
[see http://www.db.informatik.uni-kassel.de/Help/xml/cocoon/userdocs/concepts/actions.html]

Context context = ObjectModelHelper.getContext(objectModel);
String path = context.getRealPath(request.getServletPath());
java.io.File f = new java.io.File(path);
if (!f.isDirectory())
path = f.getParentFile().getAbsolutePath();
sitemapParams.put("path", path);

2. In the transform element of your sitemap add a parameter to pass
the path to the xsl.
<map:parameter name="path" value="{path}" />

3. In your xsl, add a parameter to use the path in your xsl.
<xsl:param name="path" select="''"/>

background-image="url('{$path}/copy.gif')"

Hope this helps,
Patrick
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,573
Members
45,046
Latest member
Gavizuho

Latest Threads

Top