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 Jerry <je...@yahoo.com> on 2004/04/09 20:13:22 UTC

It works!! re:only display the text in XSL file but does not display the image

Chris,

It works. It works perfect. Thanks a lot. 

Here I want to give my deep thanks to:
Jeremias Maerki, Chris Pratt, Clay Leeds, John Austin,
Chris Bowditch, and Tiffany Sun(I am sorry if I miss
someone). You guys gave me so much help. Especially, I
want to give my special thanks to Jeremias. He spent a
lot of time helping me and leading me to the right
direction without being tired of my continuous
bothering at all. You guys are so helpful and
professional. This is a greatest technical mail group
I ever work with. 

By the way, I really need to spend more time to study
FOP and XSL.

Here I want to summarize our discussion as a reference
in case someone has same need later.

Problem: 
want to use servlet to render  binary tiff data which
is stored in memory directly to web broswer in PDF
format.

Possible solution:
Implementation using JAXP, FOP with XSL

specifically,
1. Inside XSL,  add the following line right before
<xsl:template match="...">
 
<xsl:param name="image" select="'parameter not set'"/>
 
2. also inside XSL file, using the following syntax to
get external graphic(in my case, image parameter pass
a string which points to another servlet that return a
byte stream of binary tiff data):

<fo:external-graphic width="auto" height="auto"
overflow="hidden" src="url('{$image}')"/>

3. Inside mail servlet, do something like this to set
parameter value using Transformer object:

TransformerFactory factory =
TransformerFactory.newInstance();
            Transformer transformer =
factory.newTransformer(new StreamSource(xsltfile));
        
        	
String GetByteStreamServletURL="http://" +
req.getServerName() + ":" + req.getServerPort() +
"/MaxTradDownload/GetByteStream?" +
req.getQueryString();

	
              	transformer.setParameter("image",
GetByteStreamServletURL);
        	
It should works!

Have a great "Good Friday"!,


Jerry 

--- Chris Pratt <ch...@planetpratt.com> wrote:
> Actualy Jeremias I think you meant:
> 
> <xsl:param name="image" select="'parameter not
> set'"/>
> 
>   (*Chris*)
> 
> 
> Original Message -----------------------
> Ah, then add the following near the top of your
> stylesheet (before the
> first "xsl:template"):
> 
> <xsl:variable name="image" select="'parameter not
> set'"/>
> 
> 
> On 09.04.2004 18:04:34 Jerry wrote:
> > Jeremias,
> >
> > This time, I got this error:
> >
> > Error 500:
> >
>
javax.xml.transform.TransformerConfigurationException:
> > javax.xml.transform.TransformerException:
> > org.apache.xml.utils.WrappedRuntimeException:
> Could
> > not find variable with the name of image
> >
> > I replaced src="url('{@image}')" with
> > src="url('{$image}')".
> >
> > I set the parameter using this:
> >
> > String GetByteStreamServletURL="http://" +
> > req.getServerName() + ":" + req.getServerPort() +
> > "/MaxTradDownload" + "/GetByteStream?" +
> > req.getQueryString();
> >
> > transformer.setParameter("image",
> > GetByteStreamServletURL);
> 
> 
> Jeremias Maerki
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> fop-user-unsubscribe@xml.apache.org
> For additional commands, e-mail:
> fop-user-help@xml.apache.org
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> fop-user-unsubscribe@xml.apache.org
> For additional commands, e-mail:
> fop-user-help@xml.apache.org
> 


__________________________________
Do you Yahoo!?
Yahoo! Small Business $15K Web Design Giveaway 
http://promotions.yahoo.com/design_giveaway/

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