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; 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: [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 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Dynamic XSLT based on User In, Rangarajan Calyanako | Thread | RE: [xsl] Dynamic XSLT based on Use, Michael Kay |
[xsl] advice/experience to share on, Terence Kearns | Date | Re: [xsl] linefeed to <br/> templat, Flemming Jønsson |
Month |