This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: the difference between xsl:variable and xsl:param
- From: "=?big5?B?qkwgpGyq5A==?=" <minikittygo at hotmail dot com>
- To: xsl-list at lists dot mulberrytech dot com
- Date: Wed, 13 Feb 2002 16:32:27 +0000
- Subject: RE: [xsl] the difference between xsl:variable and xsl:param
- Reply-to: xsl-list at lists dot mulberrytech dot com
Thanks Andy, however do you how this should be done using xalan? thanks
Regards
Kit
>From: "Andrew Welch" <andrew@thebristoldirectory.com>
>Reply-To: xsl-list@lists.mulberrytech.com
>To: <xsl-list@lists.mulberrytech.com>
>Subject: RE: [xsl] the difference between xsl:variable and xsl:param
>Date: Tue, 12 Feb 2002 16:07:18 -0000
>
>
>
> >Hi, can everyone tell me the difference between xml:param and
xml:variable,
> >i got pretty confused over the use of the two. Secondly, can anyone tell
me
> >how to pass a variable to an xsl (e.g. <xsl:template
> >match=".//c="?variable"/> where as ?variable is pass down to the
stylesheet
> >through javascript. unfortunately i have no idea where to start over
such
> >script. can anyone tell whether this is possible and if so, can somebody
> >give me a starting point over this.
>
>Hi,
>
>(btw, this is becoming a faq but I cant find it on dave's or jeni's sites
-
>does it warrant being added?)
>
>yes, its possible pass parameters into stylesheets using javascript.
>
>Using msxml4:
>
>
> function load()
> {
> xml = new ActiveXObject("Msxml2.DOMDocument.4.0");
> xml.async = false;
> xml.load("youXMLfile.xml");
>
> xsl = new ActiveXObject("Msxml2.FreeThreadedDOMDocument.4.0");
> xsl.async = false;
> xsl.load("yourXSLfile.xsl");
>
> template = new ActiveXObject("Msxml2.XSLTemplate.4.0");
> template.stylesheet = xsl;
>
> processor = template.createProcessor();
> processor.input = xml;
> processor.addParameter("param1", "someValue");
> processor.addParameter("param2", "someOtherValue");
>
> processor.transform();
>
> document.write(processor.output);
> }
>
>You then need to add the xsl:params as a top level elements in your
>stylesheet to receive the parameters. So in this case:
>
><xsl:stylesheet xmlns:xsl="http:.....
><xsl:param name="param1"/>
><xsl:param name="param2"/>
>
>Notice the name must match the first parameter in addParameter(). You can
>then access the parameter using the dollar sign - $param1.
>
>If you are using msxml3 or lower, remember to alter the '.4.0' on the
object
>ids.
>
>
>cheers
>
>andrew
_________________________________________________________________
在您的行動裝置上傳送接收 Hotmail 郵件,請移至 http://mobile.msn.com。
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list