[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: How to obtain parameters with the xsl?
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|