xsl-list
[Top] [All Lists]

RE: How to obtain parameters with the xsl?

2002-11-04 02:24:44
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(_dot_)Elovirta(_at_)nokia(_dot_)com 
[mailto:Jarno(_dot_)Elovirta(_at_)nokia(_dot_)com]
Sent: 04 November 2002 07:31
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
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



<Prev in Thread] Current Thread [Next in Thread>