You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by Balajee Chandrasekaran <ba...@mastek.com> on 2002/10/08 08:54:21 UTC

RE: Passing parameters to XSL file throgh Java Application

Hi,
XSLTInputHandler does not provide any methods to pass parameters to the xsl file.

But in the XSLTInputHandler there is a method called
"public XMLReader getParser()"

This method actually handles A "Transformer Object". I would suggest you to go through this class. It is available at 
"FOPROOT\src\org\apache\fop\apps\XSLTInputHandler.java"

I think there is a possibility of extending XSLTInputHandler and include your functionality by overriding the 
"public XMLReader getParser()"
method.

If you get a better solution do let us know

regards
Balajee Chandrasekaran

-----Original Message-----
From: sujata shetty [mailto:sujatashetty@yahoo.com]
Sent: Tuesday, October 08, 2002 11:49 AM
To: fop-user@xml.apache.org
Subject: RE: Passing parameters to XSL file throgh Java Application


Hi Balajee,
  Thanks for the reply.
The code of TransformerFactory  is working fine if the
file transformation is either to HTMl or CSV. But in
case of PDF it is not working.
I am using the below code (FOP) for PDF
transformation.
  Driver driver = new Driver();
   driver.setRenderer(Driver.RENDER_PDF);
   InputHandler inputHandler = new
XSLTInputHandler(new     File(xmlFile), new
File(xslFile));
        org.xml.sax.XMLReader parser =
inputHandler.getParser();
        driver.setOutputStream(new
FileOutputStream(outFile));
        driver.render(parser,
inputHandler.getInputSource());

But I don't know, How do I pass paramters in the above
mentioned code


Thanks and Regards,
Sujata

--- Balajee Chandrasekaran <ba...@mastek.com>
wrote: > Following code snippet Enables parameter
passing
> through Java
> 
>     TransformerFactory tFactory =
> TransformerFactory.newInstance();
>     Transformer transformer =
> tFactory.newTransformer(new
> StreamSource("foo.xsl"));
>     // Set the parameter. 
>     transformer.setParameter("param1",	/* parameter
> name */ paramValue /* parameter value */ );
>     transformer.transform(new
> StreamSource("foo.xml"), new
> StreamResult(System.out));
> 
> Hope this helps.
> 
> regards
> Balajee Chandrasekaran
> 
> -----Original Message-----
> From: sujata shetty [mailto:sujatashetty@yahoo.com]
> Sent: Tuesday, October 08, 2002 11:19 AM
> To: fop-user@xml.apache.org
> Subject: Passing parameters to XSL file throgh Java
> Application
> 
> 
> Hi,
>   I am creating a PDF file from an XML throgh XSL FO
> stylesheet.
> It is working fine.
> BUt I need to pass some parameters to XSL sheet
> through JAVA program. 
> If parameter passing is done through XML
> Transformer,
> It will not transform to PDF and I am anable to open
> PDF file.
> Can anyone help me out in passing parameters to XSL
> through JAVA to create PDF file?
> 
> 
> Thanks and Regards,
> Sujata
> 
> __________________________________________________
> Do You Yahoo!?
> Everything you'll ever need on one web page
> from News and Sport to Email and Music Charts
> http://uk.my.yahoo.com
> 
> 
> MASTEK
> Investing in relationships
> In the US, we're called MAJESCO
> 
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Opinions expressed in this e-mail are those of the
> individual and not that of Mastek Limited, unless
> specifically indicated to that effect. Mastek
> Limited does not accept any responsibility or
> liability for it. This e-mail and attachments (if
> any) transmitted with it are confidential and/or
> privileged and solely for the use of the intended
> person or entity to which it is addressed. Any
> review, re-transmission, dissemination or other use
> of or taking of any action in reliance upon this
> information by persons or entities other than the
> intended recipient is prohibited. This e-mail and
> its attachments have been scanned for the presence
> of computer viruses. It is the responsibility of the
> recipient to run the virus check on e-mails and
> attachments before opening them. If you have
> received this e-mail in error, kindly delete this
> e-mail from all computers.
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>  

__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com


MASTEK
Investing in relationships
In the US, we're called MAJESCO

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Opinions expressed in this e-mail are those of the individual and not that of Mastek Limited, unless specifically indicated to that effect. Mastek Limited does not accept any responsibility or liability for it. This e-mail and attachments (if any) transmitted with it are confidential and/or privileged and solely for the use of the intended person or entity to which it is addressed. Any review, re-transmission, dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. This e-mail and its attachments have been scanned for the presence of computer viruses. It is the responsibility of the recipient to run the virus check on e-mails and attachments before opening them. If you have received this e-mail in error, kindly delete this e-mail from all computers.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


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