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

Re: how to assign a xsl variable from a javascript fun

Subject: Re: how to assign a xsl variable from a javascript function
From: "Andrew Welch" <andrew@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 26 Dec 2001 18:05:41 -0000
javascript fun
Hi,

I think you mean you want to pass in a parameter from a javascript function,
if so try:

(this is assuming you have msxml3 installed)

function whatever(){

  var xml = new ActiveXObject("MSXML2.DomDocument.3.0");
  xml.async = false;
  xml.load("yourXmlFile.xml");

  var xsl = new ActiveXObject("MSXML2.FreeThreadedDomDocument.3.0");
  xsl.async = false;
  xsl.load("yourXslFile.xsl");

  var template = new ActiveXObject("MSXML2.XSLTemplate")
  template.stylesheet = xsl
  processor = template.createProcessor()

  processor.input = xml
  processor.addParameter("param1", "param1value")
  processor.addParameter("param2", "someOtherValue")
  //and so on

  processor.transform()

  document.open()
  document.write(processor.output)
  document.close()
}

Make sure you include the following param declarations as top-level elements
(basically below the namespace) of your stylesheet:

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:param name="param1"/>
<xsl:param name="param2"/>

You can then access the params using $param1 and so on...

Remember, once a variable is assigned a value in a stylesheet in cannot be
changed - its more like a constant.

cheers

andrew


-----Original Message-----
From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Saurabh
Mahajan
Sent: Wednesday, December 26, 2001 6:07 AM
To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx
Subject:  how to assign a xsl variable from a javascript function


hi,

i am relatively new to the xsl world. can anyone tell me how to assign a xsl
variable from a javascipt function.
thanks in advance.

saurabh.

 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

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.