This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: Passing parameter to stylesheet from servlet


Try using:
processor.setStylesheetParam("category", "'"+category_+"'" );
etc.

where the second method argument is a string made up of a single quote (in
quotes) followed by the parameter followed by another single quote (again in
quotes).

> -----Original Message-----
> From:	Manjul Sahay [SMTP:manjuls@iitk.ac.in]
> Sent:	Thursday, November 09, 2000 3:32 PM
> To:	XSL list
> Subject:	Passing parameter to stylesheet from servlet
> 
> hi,
> please help me on this regard !
> 
> How do I pass request parameters to stylesheet from a servlet. ?
> The problem is that the 2nd argument of the method
> setStylesheetParam("","")
> , takes an expression and string has to be given like "'I am a string '".
> Now how do I pass request parameters in this 2nd argument ?
> 
> The code i am using is faulty and I want to know how to correct it -
> 
> String category_ = request.getParameter("category");
> String topic_ = request.getParameter("topic");
> String course_ = request.getParameter("course");
> String file_ = request.getParameter("file");
> 
> XSLTProcessor processor = XSLTProcessorFactory.getProcessor();
> 
> XSLTInputSource input=new
> XSLTInputSource("file:///c:/jdk/library/insert.xml");
> XSLTInputSource style=new
> XSLTInputSource("file:///c:/jdk/library/insert.xsl");
> XSLTResultTarget output=new XSLTResultTarget("c:/jdk/library/try.xml");
> 
> try{ 
> 
> processor.setStylesheetParam("category",category_); 
> processor.setStylesheetParam("topic","'topic_'"); 
> processor.setStylesheetParam("course","'course_'"); 
> processor.setStylesheetParam("file","'file_'"); 
> 
> 
> THANKS in advance
> manjul
> 


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]