[xsl] Re: passing values from JavaScript to XSL using MSXML3

Subject: [xsl] Re: passing values from JavaScript to XSL using MSXML3
From: "Dimitre Novatchev" <dnovatchev@xxxxxxxxx>
Date: Sun, 20 Jul 2003 09:50:09 +0200
Lars' explanation was quite clear. For more details read your MSXML4 SDK
documentation on addParameter() method

(mk:@MSITStore:C:\Program%20Files\MSXML%204.0\doc\xmlsdk.chm::/htm/xml_mth_a
c_5pgy.htm)

and run the provided examples.



=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL





"Sergey Demidenko" <sergeyd@xxxxxxx> wrote in message
news:001101c34e8c$91dfb110$6600a8c0@xxxxxxxxxxxx
> I need to pass a value from JavaScript code to <xsl:param name="sortBy"
> select="'date'" /> in XSL code.
> How would I accomplish this?
>
> I read this bit, and wasn't exactly clear on the whole JavaScript part.
>
> > > I want to use this value as a filter for another bit of xsl:
> > >
> > > <xsl:for-each select="mabinogion/tale[talename=' ->x goes here<- ']">
> > >         <xsl:for-each select="manuscript">
> > >                 <xsl:value-of select="manuscriptname"/>
> > >                 <br/>
> > >         </xsl:for-each>
> > > </xsl:for-each>
> >
> > OK. The x is declared in the Javascript within your page, and you want
> > it to be used within a stylesheet that you're using from that
> > Javascript. The standard way of making that happen is to pass the
> > value of x in as a parameter to the stylesheet. You need to declare
> > the parameter at the top level of the stylesheet:
> >
> > <xsl:param name="x" select="'default'" />
> >
> > and then use it in the select expression as above:
> >
> >   <xsl:for-each select="mabinogion/tale[talename = $x]">
> >      ...
> >   </xsl:for-each>
> >
> > How you pass in the value depends on the XSLT processor.  I guess that
> > you're using MSXML3, so you want something along the lines of:
> >
> >    var x = tales.tales.value;
> >    ...
> >    XSLTProcessor.addParameter('x', x);
> >    XSLTProcessor.transform();
> >    list.innerHTML = XSLTProcess.output;
> >
> > Note that the stylesheet here is run on an entire source XML, and
> > everything that it produces is put within the innerHTML of the list,
> > so you want it to only produce whatever you want within the list.
>
>
>  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