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

Re:

Subject: Re:
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Mon, 29 Jan 2001 21:19:12 +0000
 Re:
Hi Frank,

> please, is there any way to affect an xml variable with the output
> return of a JavaScript function ?

Yes, but be aware that Javascript isn't incorporated into XSLT until
XSLT 1.1 or unless you're using MSXML.  The first thing that you need
to do is to declare the function within an msxsl:script element:

<msxsl:script language="javascript"
              implements-prefix="foo">
   function retrieveData() {
      return true;
   }
</msxsl:script>

In order to do this, you need to declare the 'msxsl' namespace
(urn:schemas-microsoft-com:xslt) and your own 'foo' namespace. The
'msxsl' namespace needs to be declared as an extension element prefix
(using the extension-element-prefixes attribute on xsl:stylesheet) and
the 'foo' namespace should be excluded from your result tree (using
the exclude-result-prefixes or extension-element-prefixes attribute on
xsl:stylesheet).

Once you've declared the Javascript functions like this, you can call
them within any XPath expression using, e.g.:

  foo:retrieveData()

So, to set $my_var to have the value returned by the function, use:

  <xsl:variable name="my_var" select="foo:retrieveData()" />

There's nothing in XSLT that interprets the content of an element as
something to run: calls to functions are *always* in attribute values.
  
I hope that helps,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread
  • [no subject]
    • frank Stein - Mon, 29 Jan 2001 09:00:04 -0500 (EST)
      • Jeni Tennison - Mon, 29 Jan 2001 16:21:31 -0500 (EST) <=

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.