Subject: Re: [xsl] how to assign a xsl variable from a javascript function From: "Andrew Welch" <andrew@xxxxxxxxxxxxxxxxxxxxxxx> Date: Wed, 26 Dec 2001 18:05:41 -0000 |
Hi, I think you mean you want to pass in a parameter from a javascript function, if so try: (this is assuming you have msxml3 installed) function whatever(){ var xml = new ActiveXObject("MSXML2.DomDocument.3.0"); xml.async = false; xml.load("yourXmlFile.xml"); var xsl = new ActiveXObject("MSXML2.FreeThreadedDomDocument.3.0"); xsl.async = false; xsl.load("yourXslFile.xsl"); var template = new ActiveXObject("MSXML2.XSLTemplate") template.stylesheet = xsl processor = template.createProcessor() processor.input = xml processor.addParameter("param1", "param1value") processor.addParameter("param2", "someOtherValue") //and so on processor.transform() document.open() document.write(processor.output) document.close() } Make sure you include the following param declarations as top-level elements (basically below the namespace) of your stylesheet: <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:param name="param1"/> <xsl:param name="param2"/> You can then access the params using $param1 and so on... Remember, once a variable is assigned a value in a stylesheet in cannot be changed - its more like a constant. cheers andrew -----Original Message----- From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Saurabh Mahajan Sent: Wednesday, December 26, 2001 6:07 AM To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx Subject: [xsl] how to assign a xsl variable from a javascript function hi, i am relatively new to the xsl world. can anyone tell me how to assign a xsl variable from a javascipt function. thanks in advance. saurabh. 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] how to assign a xsl variable , Saurabh Mahajan | Thread | [xsl] Conditional processing by mat, Haque, Suraiya |
Re: [xsl] Same name Elements in mor, Wendell Piez | Date | FW: [xsl] Unique sorting, Andrew Welch |
Month |