[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Accessing <xsl:param> from a javascript function

Subject: Re: Accessing <xsl:param> from a javascript function
From: "Joe Fawcett" <joefawcett@xxxxxxxxxxx>
Date: Sun, 19 Jun 2005 07:59:06 +0100
xsl param javascript
I missed the original question but you can't access $varName directly from your JavaScript, you need to pass it to the function:
<xsl:value-of select="myFunctions:showValue($varName)"/>


showValue(Value)
{
 return $varName;
}

This assumes you are talking about JavaScript within the XSLT, otherwise, if you mean script within a web page then this is run after the transformation process and has no knowledge of any stylesheet variableds. You would just pass them by using:

var varJsName = "<xsl:value-of select="$varName"/>";

If you want to pass a variable into a stylesheet as part of the querystring to be processed client side then your script parses the location.search value to extract the data and pass it to your client side scripted transform.

Joe

----- Original Message ----- From: "Van Henreich Rontal" <vanhenreich@xxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Saturday, June 18, 2005 8:46 PM
Subject: Accessing <xsl:param> from a javascript function



Hi,

I'm using Weblogic 8.1 and thus would assume I
have Apache's Xalan 2.2D11 that comes with JDK
1.4.1_02 of this version of Weblogic.  I think I'm
using XSLT 1.0.

From my code that does the transformation I passed a
parameter using transformer.setParameter("varName",
varValue); and access it from the xsl stylesheet using
<xsl:param name="varName"/>. In one of my
<xsl:template> I've included a javascript function
enclosed in <script language="javascript"></script>,
and in that function I wanted to access the parameter.
I couldn't do it using $varName, {$varName} or
'{$varName}'(if I output it using alert();).

My ultimate goal is to pass this value in javascript's
window.location as a URL parameter value, because this
javascript funtion was called by a <a
href="javascript: func()"> elsewhere.  Although I have
the option of accessing the $varName as an argument to
func() and then access that argument within the
funtion, I think this is a two way process so I would
like a cleaner, more direct access.

Thank you for anyone who can help.

Van

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.