Subject: Re: [xsl] How can I put some javascript into an xslt page From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx> Date: Tue, 17 Jun 2003 17:41:37 +0100 |
Hi Lionel, > Here is what I tried but the value nbuser is not found. > > <xsl:template match="users"> > <xsl:variable name="nbuser">hello</xsl:variable> > <script language="javascript"> > function lionel() { document.write(string($nbuser)); } > </script> > <script language="javascript">lionel();</script> > ... I think that you're trying to produce the output: <script language="javascript"> function lionel() { document.write('hello'); } </script> <script language="javascript">lionel();</script> and you want the "hello" bit to come from the value of the $nbuser variable, as declared in XSLT. To get the value of a variable, use <xsl:value-of>: <xsl:value-of select="$nbuser" /> Place this instruction in the place where you want the value of the variable to appear within the HTML that you're generating: <script language="javascript"> function lionel() { document.write('<xsl:value-of select="$nbuser" />'); } </script> <script language="javascript">lionel();</script> Cheers, Jeni --- Jeni Tennison http://www.jenitennison.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] How can I put some javascript, Lionel Crine | Thread | RE: [xsl] How can I put some javasc, Martinez, Brian |
RE: [xsl] How can I put some javasc, Martinez, Brian | Date | RE: [xsl] How can I put some javasc, Passin, Tom |
Month |