|
Subject: Re: [xsl] passing a value from HtML to XSL From: "Agnes kielen" <a.kielen@xxxxxxx> Date: Mon, 18 Feb 2002 18:46:37 +0100 |
Hello Kit,
This is a copy of a post from Andrew Welch, which was very helpful to me.
----------------------------------------------------------------
to pass in a parameter from a javascript function:
(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 Agnes
----- Original Message -----
From: "林 子芯" <minikittygo@xxxxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Monday, February 18, 2002 3:40 PM
Subject: [xsl] passing a value from HtML to XSL
>
>
> Hi, can somebody tell me how is a value in a html pass directly to an xsl?
> i have a html form that allows end user to type in the keywords, once type
> the value is pass into the xsl file. is that feasible, if not is there is
> any other ways to get round it?
>
> Thanks for your time
> Regards
> Kit
>
> _________________________________________________________________
> 在 http://explorer.msn.com.hk/intl.asp 免費下載 MSN Explorer
>
>
> 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] passing a value from HtML to , 林 子芯 | Thread | [xsl] Re: passing a value from HtML, Antonio Bueno |
| RE: evaluate() function in XPath 2., Michael Kay | Date | RE: evaluate() function in XPath 2., Curtis Burisch |
| Month |