SV: [xsl] Dynamic XSLT based on User Input (SAME xsl file)

Subject: SV: [xsl] Dynamic XSLT based on User Input (SAME xsl file)
From: "Marcus Andersson" <marcan@xxxxxxx>
Date: Wed, 8 Oct 2003 08:35:55 +0200
2) and 3) is out of the question.

1) 4) kan be solved if you pass parameters to IXSLProcessor and invoke
the transformation on the processor instead of via the simpler
transformNode (or transformNodeToObject).

// Create and load xml document
var xmlDoc = new ActiveXObject("Msxml2.DOMDocument.4.0");
xmlDoc.async = false;
xmlDoc.resolveExternals = false;

// Create and load xsl document
var xslDoc = new ActiveXObject("Msxml2.FreeThreadedDOMDocument.4.0");
xslDoc.async = false;
xslDoc.resolveExternals = false;

// Create a XSL Template and set it's stylesheet to the loaded xsl doc.
var xslTemplate = new ActiveXObject("Msxml2.XSLTemplate.4.0");
xslTemplate.stylesheet = xslDoc;

// Create the processor
var proc = xslTemplate.createProcessor();
// Add parameters (params can be dom nodes, booleans, integers and
proc.addParameter("aParam", myStringValue);
// Invoke processor
proc.input = xmlDoc;
var result = proc.output;

In your stylesheet you add the following element as a child to the
stylesheet element:
<xsl:param name="aParam" select="aDefaultValue"/>


-----Ursprungligt meddelande-----
Från: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] För Rangarajan
Skickat: den 8 oktober 2003 08:13
Till: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Ämne: [xsl] Dynamic XSLT based on User Input (SAME xsl file)

I have an XML file with data.  I have an XSL file that can represent the
data in a specific format dependent on a given parameter.  Now the
is selected by the user using an HTML dropdown list.  How can I pass the

user selection to the XSLT portion?

If I know the answer to any of the following questions, I can work it

1) How can I pass URL parameters to an XSL-T file?  Is Cocoon the only

2) How can I register event handlers for HTML widgets/controls (like 
buttons, dropdown lists etc) with msxsl:script function (instead of the 
typical javascript functions?)

3) How can I access javascript functions from within msxsl:script

4) How can I assign a value to an xsl:variable by invoking a javascript 
function (NOT an msxsl:script function)

Share your photos without swamping your Inbox.  Get Hotmail Extra

 XSL-List info and archive:

 XSL-List info and archive:

Current Thread