RE: [xsl] How to obtain parameters with the xsl?

Subject: RE: [xsl] How to obtain parameters with the xsl?
From: Marcial Atienzar Navarro <maratna@xxxxxxxxxxxxx>
Date: Mon, 04 Nov 2002 11:08:57 +0100 (CET)
Hello,

 I'm using jstl to parse the file. With this parser I can pass param to the xsl
by the way:

<x:transform xml="${xmldocument}" xslt="${xslt}">
  <x:param name="nodo_id" value="${nodo_id}"/>
  <x:param name="almacen_id" value="${almacen_id}"/>
  <x:param name="modalidad" value="${modalidad}"/>
</x:transform>

and after that I can take them on the xsl by this:
<xsl:param name="nodo_id"></xsl:param>
<xsl:param name="almacen_id"></xsl:param>
<xsl:param name="modalidad"></xsl:param>
<xsl:param name="prueba"/>

how Jarno has reply on his email.

Marcial



Missatge citat per: Steve Clay <steve.clay@xxxxxxxxxxxx>:

> Hi
> 
> I've been struggling with this too. I have some xml which I want to
> display in a browser, having transformed it to html using xslt. The
> stylesheet needs to select just some of the data: which data exactly is
> known only at runtime. So ideally I'd like to pass a parameter on the
> url like you can do with html pages: 
> 
> 	(a) html like this: "http://somewhere/myhtmlpage.htm?some-param.
> 	(b) xml like this?: "file:///c:\path\filename.xml?some-param
> 
> I have managed to do this by 1) having a real html file with a body
> consisting of a single <div/> element, (2) loading the xml file, (3)
> creating a new node, (4) extracting the url parameter using the
> javascript "document.location.search.substring(1);", (5) setting the new
> node's value to this parameter and finally (5) loading the xslt, which
> can now access the node I just added and use it to select just the data
> required before assigning it to the <div> element in the body of the
> page. Phew! Is there an easier and more elegant way? 
> 
> On this topic Jarno.Elovirta said "Top-level xsl:param element with the
> same name." I wondered if this meant I could just put "<?xml-stylesheet
> type="text/xsl" href="Data.xslt"?> at the top of my xml file and load it
> in Explorer using something like (b) above but if I have a stylesheet
> with a parameter element at the top level MXSML v4.0 just says "Keyword
> xsl:stylesheet may not contain xsl:parameter." So, I'm sorry Jarno but I
> don't understand what you meant.
> 
> Anyone any suggestions or ideas please?
> Kindest regards.
> Steve Clay
> 
> -----Original Message-----
> From: Jarno.Elovirta@xxxxxxxxx [mailto:Jarno.Elovirta@xxxxxxxxx]
> Sent: 04 November 2002 07:31
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: RE: [xsl] How to obtain parameters with the xsl?
> 
> 
> Hi,
> 
> >  I need to obtain parameters with the xsl. How can I do it? 
> > I'm using xalan o
> > jstl to make the parser, and I know how to pass the 
> > parameters, but i don't know
> > how to obatin them.
> 
> Top-level xsl:param element with the same name.
> 
> Cheers,
> 
> Jarno
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 
> 

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


Current Thread