[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: How to obtain parameters with the xsl?

Subject: RE: How to obtain parameters with the xsl?
From: "Steve Clay" <steve.clay@xxxxxxxxxxxx>
Date: Mon, 4 Nov 2002 09:24:44 -0000
steve clay
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:  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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.