|
Subject: RE: [xsl] javascript variable in xsl:variable From: "Dion Houston" <dionh@xxxxxxxxxxxxx> Date: Thu, 25 Apr 2002 14:37:52 -0700 |
To expand the discussion a little bit... what do you intend to do with
this?
If it's simply to create an HTML version of an XML document, then you
should be perfectly fine. As a matter of style, I'd write it:
<xsl:template match="/">
<xsl:variable name="varID">strID</xsl:variable>
<script language="javascript">
function test(strID)
{
alert('<xsl:value-of select="$varID"/>')
}
</script>
</xsl:template>
To make it more obvious that the variable is associated with the XSL
rather than the script, but either way is correct.
If you are intending on writing script inside an XSLT script (e.g. to
expand the processing of the script), this approach will not work for
the reasons Theo mentioned.
HTH!
Dion
-----Original Message-----
From: Brinkman, Theodore [mailto:Theodore.Brinkman@xxxxxxxxxxxxxxxxxxxx]
Sent: Thursday, April 25, 2002 2:20 PM
To: 'xsl-list@xxxxxxxxxxxxxxxxxxxxxx'
Subject: RE: [xsl] javascript variable in xsl:variable
For a case like your example, you need to remember that until the
tranformation is finished, the javascript won't actually be running, so
the
javascript variable won't have any value.
The XSL generates a node-tree, which is (usually) serialized out to text
and
sent off to have something else use it, so none of the javascript will
be
interpreted as anything except the contents of a node-tree until it gets
to
that something else.
- Theo
-----Original Message-----
From: Ken Schulte [mailto:kschulte@xxxxxxxxxx]
Sent: Thursday, April 25, 2002 4:56 PM
To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx
Subject: [xsl] javascript variable in xsl:variable
Does anybody know if it is possible to add a javascript variable
into an xsl:variable?
example:
<xsl:template match="/">
<script language="javascript">
function test(strID)
{
<xsl:variable name="varID">
strID
</xsl:variable>
alert('<xsl:value-of select="$varID"/>
}
</script>
</xsl:template>
Thank you much,
Ken
________________________________________________
Get your own "800" number
Voicemail, fax, email, and a lot more
http://www.ureach.com/reg/tag
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-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 |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: RE: [xsl] javascript variable i, Ken Schulte | Thread | Re: RE: [xsl] javascript variable i, Ken Schulte |
| Re: [xsl] Fwd: Over/under trimming , Thomas B. Passin | Date | Re: [xsl] javascript variable in xs, Joerg Heinicke |
| Month |