There are probably other ways to do this, but my suggestion (only thing I could
think of), would be to have the XSL be generated by another JSP, and put the URL
to that JSP in the xsl="" attribute, along with the URL param with the lang i.d.
So your XSLT tag would look something like:

<jrun:xslt xsl=�<%= new URL("http://foo.com/language.jsp?LANG=FR") %>'
xml="data.xml"/>


And your XSL JSP would be whatever it is already, plus some minor tweaks, viz.:

<%@ page contentType="text/xsl" %>
<?xml version="1.0"?>
<xsl:stylesheet
  version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:param name="lang"><%= request.getParamter("LANG") %></xsl:param>
[etc.]


Maybe we should make it so the XSLT tag can optionally take a nested XSL tag.
Right now you can put your XML input as bodyContent to the XSLT tag, but your
only option with the XSL input is to use a URL.  If we could set the XSL input
in the JSP itself, then you could use the expression right in the page without
invoking the JSP over the network.  Then again, maybe there's another way to do
this that I'm not seeing.  Here's what I think would be cool:

<jrun:xslt scope="request" id="output">
  <jrun:xml>
   . . . .
   . . . .  <--here would go XML input,
   . . . .     which could include expressions
 </jrun:xml>
 <jrun:xsl>
   . . . .
   . . . .  <--here would go XSL input,
   . . . .     which could include expressions
 </jrun:xsl>
</jrun:xslt>

Of course another cool thing would be if the xsl="" and xml"" attributes could
operate like a static JSP include.  That way you could have your XSL/JSP (the
first example) processed as an include, rather than having to open a URL
connection to request the page and get it processed that way.

Any ideas?


Scott Stirling
Allaire

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Monday, September 11, 2000 12:06 PM
> To: [EMAIL PROTECTED]
> Subject: passing parameters to an xsl template using jrun:xslt
>
>
> how can i pass a parameter to an xsl template using the jrun:xslt
> tag? i have an xml file with several languages coded into it, and if
> i simply hard code a param at the beginning of the xsl file, eg.
> <xsl:param name="lang">FR</xsl:param>, it spits out the French
> version of the xml file. How can I pass this parameter dynamically,
> so that it can be determined from the url, a cookie, a session var,
> etc. in the jsp file? My goal is to call
> www.mysite.com/page.jsp?lang=EN and have the variable passed along to
> the xsl file when it is called using <jrun:xslt xsl="language.xsl"
> xml="data.xml"/>

------------------------------------------------------------------------------
Archives: http://www.egroups.com/group/jrun-interest/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebarRsts&bodyRsts/jrun_talk
or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the 
body.

Reply via email to