You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Toufic Nehme <to...@canadair.ca> on 2003/10/16 18:01:11 UTC

passing parameters to the stylesheet

Hi to everyone,
in FopServlet i'm doing  the following:
XSLTInputHandler input =
          new XSLTInputHandler(new File(xmlParam),
                                                new File(xslParam));
input.setParameter("logo", "http://"+request.getServerName()
+":"+request.getServerPort()+ request.getContextPath() + "/" +
request.getParameter("img") );
renderXML(input, response);

In the stylesheet i defined  <xsl:param name="logo" />  as child of
<xsl:stylesheet >
and later on in the stylesheet I try to reference $logo
<fo:external-graphic display-align="auto" src="url({$logo})"
width="5.25cm" height="1.75cm"/>
but I have the following message:
[ERROR] Error while creating area : Error with image URL:  (The system
cannot find the path specified) and no base URL is specified

If I print out in the servlet "http://"+request.getServerName()
+":"+request.getServerPort()+ request.getContextPath() +
request.getParameter("img") ;
I have the right information and I can browse the image.
If I hardcode the link to the image in the stylesheet as a default value
to param logo, everything is ok too.

Am i doing the right thing ? If not, how can i pass a parameter to the
stylesheet ?

Is it possible also in batch to pass parameters with the script fop.sh,
like -param <name> <value> ??

Any hint is appreciated.

I'm using fop 0.20.5, xalan-2.4.1, websphere 4.0.3 , IBM  JDK 1.3.0,
platform IBM AIX 5.1, Adobe Reader 6.0.
Same problem also with  tomcat, j2sdk1.4.1, Win NT 4.0 sp6a, Adobe
Reader 6.0

Thank you.



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


Re: passing parameters to the stylesheet

Posted by "J.Pietschmann" <j3...@yahoo.de>.
Toufic Nehme wrote:
> input.setParameter("logo", "http://"+request.getServerName()

IIRC this is broken. Create and use a j.x.t.Transformer directly,
see
http://cvs.apache.org/viewcvs.cgi/xml-fop/examples/embedding/java/embedding/ExampleXML2PDF.java?rev=HEAD

J.Pietschmann



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org