Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

JSP to send a parameter to XSL doc

Status
Not open for further replies.

pcrogers

Programmer
Joined
Jan 28, 2004
Messages
2
Location
CA
Hey everyone,

Still fairly new to this but I want to add to my object, before I transform, a parameter which I have declared in my XSL document.

Here is the JSP code:
<%@page contentType="text/html"%>
<%@page errorPage="error.htm"%>
<%@page import="javax.xml.transform.TransformerFactory"%>
<%@page import="javax.xml.transform.Transformer"%>
<%@page import="javax.xml.transform.stream.StreamSource"%>
<%@page import="javax.xml.transform.stream.StreamResult"%>
<HTML>
<%
String org = request.getParameter("org");
if(org != null){
String xml=" org+ ".xml";
Sring xmlRef=xml;
String xsltRef=" TransformerFactory tFactory = TransformerFactory.newInstance();
StreamSource xsltSource = new StreamSource(xsltRef);
Transformer transfomer = tFactory.newTransformer(xsltSource);
StreamSource xmlSource = new StreamSource(xmlRef);
StreamResult outToBrowser = new StreamResult(out);
transformer.transform(xmlSource, outToBrowser);
}
else{
same as above except using a default xml page
}
%>
</HTML>

So i need to have a transform.addParameter or setParameter before I outsource it and I am not sure of the proper syntax on the method I need to use. I need to send it the value of org which was originally sent to the JSP file. The reason for this is I need to use it within the XSL document in order to reprocess the JSP again when a link is clicked.

Second question:
in my XSL I have <xsl:param name="org">value</xsl:param> How do I reference this later in the document??

Thanks in advance just kinda starting to get a hang of all this.

Thanks in advance,
Phil
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top