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

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

Subject: SV: Dynamic XSLT based on User Input (SAME xsl file)
From: "Marcus Andersson" <marcan@xxxxxxx>
Date: Wed, 8 Oct 2003 08:35:55 +0200
dynamic xslt
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;
xmlDoc.load("urltoyourxml");

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

// 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
strings)
proc.addParameter("aParam", myStringValue);
// Invoke processor
proc.input = xmlDoc;
proc.transform();
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"/>

/Marcus

-----Ursprungligt meddelande-----
Från: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] För Rangarajan
Calyanakoti
Skickat: den 8 oktober 2003 08:13
Till: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Ämne:  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
XML 
data in a specific format dependent on a given parameter.  Now the
parameter 
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
out!

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

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
function?

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
Storage 
today! http://join.msn.com/?PAGE=features/es


 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.